JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
vis_transform_view.h File Reference

Implementation of the jh::ranges::vis_transform_view class — a non-consuming, observation-oriented transformation view. More...

#include "jh/conceptual/range_traits.h"
#include <utility>

Go to the source code of this file.

Classes

class  jh::ranges::vis_transform_view< R, F >
 A non-consuming transform view preserving reentrancy. More...
struct  jh::ranges::vis_transform_view< R, F >::iterator
 Iterator type implementing the transformation projection. More...

Namespaces

namespace  jh::ranges
 Semantic pipeline namespace for JH range operations.

Functions

template<typename R, typename F>
 jh::ranges::vis_transform_view (R &&, F) -> vis_transform_view< std::views::all_t< R >, F >
 Deduction guide for vis_transform_view.

Variables

template<typename R, typename F>
constexpr bool std::ranges::enable_borrowed_range< jh::ranges::vis_transform_view< R, F > >
 Legal specialization of std::ranges::enable_borrowed_range.

Detailed Description

Implementation of the jh::ranges::vis_transform_view class — a non-consuming, observation-oriented transformation view.

Author
JeongHan-Bae mastr.nosp@m.opse.nosp@m.udo@g.nosp@m.mail.nosp@m..com

The jh::ranges::vis_transform_view represents the underlying mechanism used by jh::ranges::views::vis_transform. It applies a callable over a range without consuming the source elements, preserving reentrancy and the integrity of the underlying data.

Core semantics

  • Transforms elements through an observational projection (the callable must return a non-void value).
  • Does not mutate or consume the source range — iteration is repeatable.
  • Implements std::ranges::view_interface for composability.
  • Acts as a lightweight, fully constexpr-compatible wrapper.

This class template is instantiated only when jh::concepts::vis_function_for<F, R> is satisfied. That concept ensures both that the callable F can be safely applied to R and that the transformation does not alter or terminate the stream.

In contrast to std::views::transform, which models a potentially consumptive view, vis_transform_view guarantees the output remains non-consuming and fully reentrant.

See also
jh::ranges::views::vis_transform
jh::concepts::vis_function_for
std::views::transform
Version
1.3.x
Date
2025