|
Range primitives | |||||||
|
Range concepts | |||||||||||||||||||
|
Range factories | |||||||||
|
Range adaptors | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
Helper items | |||||||||||||||||
|
Defined in header <ranges> | ||
template<ranges::input_range V> requiresranges::view<V> | (1) | (since C++26) |
namespace views{ inlineconstexpr/* unspecified */ to_input=/* unspecified */; | (2) | (since C++26) |
Call signature | ||
template<ranges::viewable_range R> requires/* see below */ | (since C++26) | |
view
as aninput_range
-only and not acommon_range
.T
modelsinput_range
,T
does not satisfycommon_range
, andT
does not satisfyforward_range
.Consequently,to_input_view
never models range concepts that are stronger thaninput_range
. In particular, it does not model all of these:
Additionally,to_input_view
does not modelcommon_range
. However, it does modelborrowed_range
,constant_range
, andsized_range
when the underlying viewV
models respective concepts.
Contents |
Member | Description |
V base_ (private) | the underlying view (exposition-only member object*) |
constructs ato_input_view (public member function) | |
returns a copy of the underlying (adapted) view (public member function) | |
returns an iterator to the beginning (public member function) | |
returns an iterator or a sentinel to the end (public member function) | |
returns the number of elements. Provided only if the underlying (adapted) range satisfiessized_range .(public member function) | |
Inherited fromstd::ranges::view_interface | |
returns whether the derived view is empty, provided only if it satisfiessized_range orforward_range (public member function of std::ranges::view_interface<D> )[edit] | |
(C++23) | returns a constant iterator to the beginning of the range (public member function of std::ranges::view_interface<D> )[edit] |
(C++23) | returns a sentinel for the constant iterator of the range (public member function of std::ranges::view_interface<D> )[edit] |
returns whether the derived view is not empty, provided only ifranges::empty is applicable to it (public member function of std::ranges::view_interface<D> )[edit] | |
gets the address of derived view's data, provided only if its iterator type satisfiescontiguous_iterator (public member function of std::ranges::view_interface<D> )[edit] | |
returns the first element in the derived view, provided if it satisfiesforward_range (public member function of std::ranges::view_interface<D> )[edit] | |
returns the last element in the derived view, provided only if it satisfiesbidirectional_range andcommon_range (public member function of std::ranges::view_interface<D> )[edit] | |
returns then th element in the derived view, provided only if it satisfiesrandom_access_range (public member function of std::ranges::view_interface<D> )[edit] |
to_input_view() requiresstd::default_initializable<V>=default; | (1) | (since C++26) |
constexprexplicit to_input_view( V base); | (2) | (since C++26) |
base_
via its default member initializer (= V()).base_
withstd::move(base).base | - | a view |
constexpr V base()const& requiresstd::copy_constructible<V>; | (1) | (since C++26) |
constexpr V base()&&; | (2) | (since C++26) |
constexprauto begin() requires(!__simple_view<V>); | (1) | (since C++26) |
constexprauto begin()const requiresranges::range<const V>; | (2) | (since C++26) |
constexprauto end() requires(!__simple_view<V>); | (1) | (since C++26) |
constexprauto end()const requiresranges::range<const V>; | (2) | (since C++26) |
constexprauto size() requiresranges::sized_range<V>; | (1) | (since C++26) |
constexprauto size()const requiresranges::sized_range<const V>; | (2) | (since C++26) |
template<class R> to_input_view( R&&)-> to_input_view<views::all_t<R>>; | (since C++26) | |
the iterator type (exposition-only member class template*) |
template<class T> constexprbool enable_borrowed_range<std::ranges::to_input_view<T>>= | (since C++26) | |
This specialization ofstd::ranges::enable_borrowed_range makesto_input_view
satisfyborrowed_range
when the underlying view satisfies it.
to_input_view
can be useful to avoid the overhead necessary to provide support for the operations needed for greater iterator strength.
Feature-test macro | Value | Std | Feature |
---|---|---|---|
__cpp_lib_ranges_to_input | 202502L | (C++26) | std::ranges::to_input_view |
This section is incomplete Reason: no example |
(C++20) | specifies a range whose iterator type satisfiesinput_iterator (concept)[edit] |
converts aview into acommon_range (class template)(range adaptor object)[edit] |