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
jh::concepts::vis_function_for Concept Reference

Concept describing the visual relation between a range and a callable. More...

#include <jh/conceptual/range_traits.h>

Concept definition

template<typename F, typename R>
concept vis_function_for = requires(const std::remove_cvref_t<R> &r, const F &f) {
{ std::begin(r) } -> std::input_iterator;
{ *std::begin(r) };
{ std::invoke(f, *std::begin(r)) };
requires (!std::is_void_v<decltype(std::invoke(f, *std::begin(r)))>);
}
Concept describing the visual relation between a range and a callable.
Definition range_traits.h:110

Detailed Description

Concept describing the visual relation between a range and a callable.

vis_function_for<F, R> formalizes a visual visitation contract: both the range and the callable must satisfy conditions for a non-consuming, non-mutating traversal with a meaningful result.

Contract Requirements

  • The range R supports non-consuming iteration โ€” calling begin() and end() does not alter its state.
  • Elements of R can be dereferenced as input iterators.
  • The callable F can be safely invoked on each element: std::invoke(f, *begin(r)) must be well-formed.
  • The invocation result is non-void, allowing the result to participate in further pipeline or transform chaining.
  • Neither the range nor its elements are modified by the operation โ€” the relation is purely observational.

In other words, vis_function_for ensures that a callable and a range can participate together in a visual transformation pipeline such as those implemented by jh::ranges::vis_transform_view.

Template Parameters
FCallable type to be applied visually to the range.
RRange type providing non-consuming elements.