std::ranges..._rvalue_view(3)
β¨ NAME β¨
std::ranges::views::as_rvalue,std::ranges::as_rvalue_view β okay bestie, thatβs the whole name, and yes itβs a mouthful. This is the C++ Standard Library manual page for std::ranges..._rvalue_view(3), and itβs all about std::ranges::views::as_rvalue and std::ranges::as_rvalue_view. Itβs giving βa view whose elements are rvaluesβ energy. π
πΈ Synopsis πΈ
Defined in header <ranges>.
template< ranges::view V >
requires ranges::input_range<V>
class as_rvalue_view
: public ranges::view_interface<as_rvalue_view<V>>
(1) (since C++23)
namespace views {
inline constexpr /* unspecified */ as_rvalue = /* unspecified */;
}
(2) (since C++23)
π¬ Call signature π¬
template< ranges::viewable_range R >
requires /* see below */
constexpr ranges::view auto as_rvalue( R&& r );
(since C++23)
- A range adaptor that represents a view of underlying view whose elements are rvalues.
RangeAdaptorObject. Letebe a subexpression and letTbedecltype((e)). Then the expressionviews::as_rvalue(e)is expression-equivalent to:views::all(e), if it is a well-formed expression andstd::same_as<ranges::range_rvalue_reference_t<T>, ranges::range_reference_t<T>>is true;as_rvalue_view{e}otherwise.
π Member functions π
constructorβ constructs anas_rvalue_view(public member function)baseβ returns the underlying viewV(public member function)beginβ returns the beginning iterator of theas_rvalue_view(public member function)endβ returns the end iterator of theas_rvalue_view(public member function)sizeβ returns the size of the view if it is bounded (public member function)
π«Ά Inherited from std::ranges::view_interface π«Ά
empty(C++20)β returns whether the derived view is empty. Provided if it satisfiessized_rangeorforward_range. (public member function ofstd::ranges::view_interface<D>)cbegin(C++23)β returns a constant iterator to the beginning of the range. (public member function ofstd::ranges::view_interface<D>)cend(C++23)β returns a sentinel for the constant iterator of the range. (public member function ofstd::ranges::view_interface<D>)operator bool(C++20)β returns whether the derived view is not empty. Provided ifranges::emptyis applicable to it. (public member function ofstd::ranges::view_interface<D>)front(C++20)β returns the first element in the derived view. Provided if it satisfiesforward_range. (public member function ofstd::ranges::view_interface<D>)back(C++20)β returns the last element in the derived view. Provided if it satisfiesbidirectional_rangeandcommon_range. (public member function ofstd::ranges::view_interface<D>)operator[](C++20)β returns then^thelement in the derived view. Provided if it satisfiesrandom_access_range. (public member function ofstd::ranges::view_interface<D>)
π std::ranges::as_rvalue_view::as_rvalue_view π
as_rvalue_view() requires std::default_initializable<V> = default;
(1) (since C++23)
constexpr explicit as_rvalue_view( V base );
(2) (since C++23)
- Value-initializes
base_via its default member initializer (= V()). - Initializes
base_withstd::move(base).
π Parameters π
baseβ a view
π¦ std::ranges::as_rvalue_view::base π¦
constexpr V base() const& requires std::copy_constructible<V>;
(1) (since C++23)
constexpr V base() &&;
(2) (since C++23)
Returns the underlying view.
- Copy-constructs the result from the underlying view. Equivalent to
return base_;. - Move-constructs the result from the underlying view. Equivalent to
return std::move(base_);.
π std::ranges::as_rvalue_view::begin π
constexpr auto begin() requires (!__simple_view<V>);
(1) (since C++23)
constexpr auto begin() const requires ranges::range<const V>;
(2) (since C++23)
1,2) Returns std::move_iterator(ranges::begin(base_)).
π₯ std::ranges::as_rvalue_view::end π₯
constexpr auto end() requires (!__simple_view<V>);
(1) (since C++23)
constexpr auto end() const requires ranges::range<const V>;
(2) (since C++23)
- Returns
std::move_iterator(ranges::end(base_))ifVmodelscommon_range, otherwisestd::move_sentinel(ranges::end(base_)). - Returns
std::move_iterator(ranges::end(base_))ifconst Vmodelscommon_range, otherwisestd::move_sentinel(ranges::end(base_)).
β std::ranges::as_rvalue_view::size β
constexpr auto size() requires ranges::sized_range<V>;
(1) (since C++23)
constexpr auto size() const requires ranges::sized_range<const V>;
(2) (since C++23)
Returns the size of the view if the view is bounded.
1,2) Equivalent to return ranges::size(base_);
π§ Deduction guides π§
template< class R >
as_rvalue_view( R&& ) -> as_rvalue_view<views::all_t<R>>;
(since C++23)
π Helper templates π
template< class T >
inline constexpr bool enable_borrowed_range<std::ranges::as_rvalue_view<T>>
= std::ranges::enable_borrowed_range<T>;
(since C++23)
This specialization of std::ranges::enable_borrowed_range makes as_rvalue_view satisfy borrowed_range when the underlying view satisfies it.
π Notes π
- Feature-test macro:
__cpp_lib_ranges_as_rvalueβ value202207L, Std(C++23), featurestd::ranges::as_rvalue_view.
π Example π
This section is incomplete.
Reason: example.
π See also π
move_iterator(C++11)β iterator adaptor which dereferences to an rvalue (class template)move_sentinel(C++20)β sentinel adaptor for use withstd::move_iterator(class template)ranges::as_const_viewβ converts a view into aconstant_rangeviews::as_const(C++23)β (class template) (range adaptor object)
π·οΈ Category π·οΈ
- Todo with reason
source/version: cppreference.com Β· date: 2024.06.10 Β· manual page: std::ranges..._rvalue_view(3) β thatβs the whole vibe, bestie, slay and bye π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms