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

STL-compatible adapter for duck-typed sequences and iterators. More...

#include "jh/conceptual/iterator.h"
#include "jh/conceptual/range_traits.h"
#include <ranges>

Go to the source code of this file.

Classes

class  jh::ranges::range_adaptor< Seq >
 Lightweight adapter that exposes any sequence as a standard range. More...

Namespaces

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

Variables

template<typename SeqType>
constexpr bool std::ranges::enable_borrowed_range< jh::ranges::range_adaptor< SeqType > >
 Legal specialization of std::ranges::enable_borrowed_range.

Detailed Description

STL-compatible adapter for duck-typed sequences and iterators.

Author
JeongHan-Bae <mastropseudo@gmail.com>

This header provides the bridge between jh::concepts::sequence and std::ranges::range. It introduces two key components:

  • jh::ranges::detail::completed_iterator โ€” a behavioral iterator adaptor that completes any duck-typed iterator to full STL iterator semantics.
  • jh::ranges::range_adaptor โ€” a lightweight view class that exposes a sequence as a std::ranges::range, using completed_iterator for begin() and directly forwarding end().

Together, they allow any object satisfying jh::concepts::sequence to be seamlessly used in std::ranges algorithms, even if it defines no iterator typedefs or category tags.