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
zip_view.h File Reference

Internal implementation for jh::ranges::zip_view. More...

#include <tuple>
#include <ranges>
#include <utility>
#include <type_traits>
#include <functional>

Go to the source code of this file.

Classes

struct  jh::ranges::is_zip_proxy< T >
struct  jh::ranges::is_zip_proxy< class zip_reference_proxy< Ts... > >
struct  jh::ranges::zip_proxy_value_tuple< T >
struct  jh::ranges::zip_proxy_value_tuple< class zip_reference_proxy< Ts... > >
struct  jh::ranges::zip_reference_proxy< Es >
 Aggregates element references for a single tuple in jh::ranges::zip_view. More...
struct  jh::ranges::zip_sentinel< Sentinels >
 Sentinel type for jh::ranges::zip_view. More...
struct  jh::ranges::zip_iterator< Iters >
 Iterator type for jh::ranges::zip_view. More...
class  jh::ranges::zip_view< Views >
 A C++20-compatible implementation of std::ranges::zip_view. More...
struct  std::tuple_size< jh::ranges::zip_reference_proxy< Elems... > >
struct  std::tuple_element< I, jh::ranges::zip_reference_proxy< Elems... > >
struct  std::common_reference< jh::ranges::zip_reference_proxy< Ts... >, std::tuple< Us... > >
struct  std::common_reference< std::tuple< Ts... >, jh::ranges::zip_reference_proxy< Us... > >
struct  std::common_reference< jh::ranges::zip_reference_proxy< Ts... >, jh::ranges::zip_reference_proxy< Us... > >
struct  std::common_reference< jh::ranges::zip_reference_proxy< Ts... > &&, std::tuple< Us... > & >
struct  std::common_reference< jh::ranges::zip_reference_proxy< Ts... > &, std::tuple< Us... > & >
struct  std::common_reference< jh::ranges::zip_reference_proxy< Ts... > &&, std::tuple< Us... > && >
struct  std::common_reference< std::tuple< Ts... > &, jh::ranges::zip_reference_proxy< Us... > && >
struct  std::common_reference< jh::ranges::zip_reference_proxy< Ts... > &&, jh::ranges::zip_reference_proxy< Us... > & >

Namespaces

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

Macros

#define JH_HAS_STD_ZIP_VIEW   0
 Feature detection for std::ranges::zip_view availability.

Typedefs

template<typename T>
using jh::ranges::zip_proxy_value_tuple_t = typename zip_proxy_value_tuple<T>::type

Functions

template<typename F, typename Tuple>
constexpr auto jh::ranges::tuple_transform (F &&f, Tuple &&t)
 Applies a callable to each element of a std::tuple.
template<std::size_t I, typename... Elems>
constexpr decltype(auto) jh::ranges::get (const zip_reference_proxy< Elems... > &p) noexcept
 Retrieves the I-th element from a zip_reference_proxy.
template<typename... Iters, typename... Sentinels>
constexpr bool jh::ranges::operator== (const zip_sentinel< Sentinels... > &s, const zip_iterator< Iters... > &it)
template<typename... Iters, typename... Sentinels>
constexpr bool jh::ranges::operator!= (const zip_sentinel< Sentinels... > &s, const zip_iterator< Iters... > &it)
template<std::ranges::viewable_range... Rs>
 jh::ranges::zip_view (Rs &&...) -> zip_view< std::views::all_t< Rs >... >
 Deduction guide for jh::ranges::zip_view.

Variables

template<typename T>
constexpr bool jh::ranges::is_zip_proxy_v = is_zip_proxy<T>::value
template<typename... Views>
constexpr bool std::ranges::enable_borrowed_range< jh::ranges::zip_view< Views... > >
 Legal specialization of std::ranges::enable_borrowed_range.

Detailed Description

Internal implementation for jh::ranges::zip_view.

Defines the implementation of jh::ranges::zip_view — a lightweight, C++20-compatible view that aggregates multiple ranges into synchronized tuples of references.

This header is part of the ranges module and serves as an internal dependency of jh::ranges::views::zip and jh::ranges::views::enumerate. It is not intended for direct inclusion by user code.

Semantic equivalence:
jh::ranges::zip_view provides the same observable behavior as std::ranges::zip_view (C++23 and later). When the standard implementation is available, jh::ranges::zip_view transparently aliases it through feature detection. Otherwise, this header defines a portable fallback implementation with identical semantics and API surface.

This design follows the same principle as boost::string_view — offering a pre-standard, fully compatible type that later becomes a transparent bridge to its standard counterpart once available.

The fallback implementation includes:

  • zip_iterator — synchronized iterator tuple
  • zip_sentinel — range termination marker
  • zip_reference_proxy — reference aggregator for structured bindings

Together, these emulate the complete semantics of std::ranges::zip_view for C++20 environments.

See also
jh::ranges::views::zip
jh::ranges::views::enumerate