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::ranges::range_adaptor< Seq > Class Template Reference

Lightweight adapter that exposes any sequence as a standard range. More...

#include <jh/ranges/range_adaptor.h>

Inheritance diagram for jh::ranges::range_adaptor< Seq >:

Public Types

using inner_iterator = decltype(std::declval<Seq &>().begin())
using sentinel = decltype(std::declval<Seq &>().end())
using iterator = detail::completed_iterator<inner_iterator, sentinel>

Public Member Functions

 range_adaptor (Seq &&s)
auto begin () noexcept(noexcept(get().begin()))
auto end () noexcept(noexcept(get().end()))

Detailed Description

template<typename Seq>
class jh::ranges::range_adaptor< Seq >

Lightweight adapter that exposes any sequence as a standard range.

Wraps a duck-typed sequence so that it models std::ranges::range.

  • begin() returns a completed_iterator wrapping the sequence's iterator.
  • end() is forwarded directly from the underlying sequence.

Enables generic algorithms and range-based for loops to work with any object satisfying jh::concepts::sequence, regardless of whether it defines STL-compatible iterator traits.

Template Parameters
SeqSequence-like type satisfying jh::concepts::sequence.
Note
If the sequence's begin() and end() types are identical, the adaptor transparently returns a completed_iterator for both. This allows the resulting view to model std::ranges::common_range, enabling tighter interoperability with standard range algorithms.

The documentation for this class was generated from the following files: