[range.elements.view]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.elements.view)

### 25.7.23 Elements view [[range.elements]](range.elements#view)

#### 25.7.23.2 Class template elements_view [range.elements.view]

[ð](#lib:elements_view)

namespace std::ranges {template<class T, size_t N>concept [*has-tuple-element*](#concept:has-tuple-element "25.7.23.2 Class template elements_­view [range.elements.view]") = // *exposition only*[*tuple-like*](tuple.like#concept:tuple-like "22.4.3 Concept tuple-like [tuple.like]")<T> && N < tuple_size_v<T>; template<class T, size_t N>concept [*returnable-element*](#concept:returnable-element "25.7.23.2 Class template elements_­view [range.elements.view]") = // *exposition only* is_reference_v<T> || [move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_­constructible [concept.moveconstructible]")<tuple_element_t<N, T>>; template<[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]") V, size_t N>requires [view](range.view#concept:view "25.4.5 Views [range.view]")<V> && [*has-tuple-element*](#concept:has-tuple-element "25.7.23.2 Class template elements_­view [range.elements.view]")<range_value_t<V>, N> &&[*has-tuple-element*](#concept:has-tuple-element "25.7.23.2 Class template elements_­view [range.elements.view]")<remove_reference_t<range_reference_t<V>>, N> &&[*returnable-element*](#concept:returnable-element "25.7.23.2 Class template elements_­view [range.elements.view]")<range_reference_t<V>, N>class elements_view : public view_interface<elements_view<V, N>> {public: elements_view() requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_­initializable [concept.default.init]")<V> = default; constexpr explicit elements_view(V base); constexpr V base() const & requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_­constructible [concept.copyconstructible]")<V> { return *base_*; }constexpr V base() && { return std::move(*base_*); }constexpr auto begin() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V>){ return *iterator*<false>(ranges::begin(*base_*)); }constexpr auto begin() const requires [range](range.range#concept:range "25.4.2 Ranges [range.range]")<const V>{ return *iterator*<true>(ranges::begin(*base_*)); }constexpr auto end() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && ![common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<V>){ return *sentinel*<false>{ranges::end(*base_*)}; }constexpr auto end() requires (![*simple-view*](range.utility.helpers#concept:simple-view "25.5.2 Helper concepts [range.utility.helpers]")<V> && [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<V>){ return *iterator*<false>{ranges::end(*base_*)}; }constexpr auto end() const requires [range](range.range#concept:range "25.4.2 Ranges [range.range]")<const V>{ return *sentinel*<true>{ranges::end(*base_*)}; }constexpr auto end() const requires [common_range](range.refinements#concept:common_range "25.4.6 Other range refinements [range.refinements]")<const V>{ return *iterator*<true>{ranges::end(*base_*)}; }constexpr auto size() requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<V>{ return ranges::size(*base_*); }constexpr auto size() const requires [sized_range](range.sized#concept:sized_range "25.4.4 Sized ranges [range.sized]")<const V>{ return ranges::size(*base_*); }constexpr auto reserve_hint() requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<V>{ return ranges::reserve_hint(*base_*); }constexpr auto reserve_hint() const requires [approximately_sized_range](range.approximately.sized#concept:approximately_sized_range "25.4.3 Approximately sized ranges [range.approximately.sized]")<const V>{ return ranges::reserve_hint(*base_*); }private:// [[range.elements.iterator]](range.elements.iterator "25.7.23.3 Class template elements_­view​::​iterator"), class template elements_view​::​*iterator*template<bool> class *iterator*; // *exposition only*// [[range.elements.sentinel]](range.elements.sentinel "25.7.23.4 Class template elements_­view​::​sentinel"), class template elements_view​::​*sentinel*template<bool> class *sentinel*; // *exposition only* V *base_* = V(); // *exposition only*};}

[ð](#lib:elements_view,constructor)

`constexpr explicit elements_view(V base);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L10267)

*Effects*: Initializes *base_* with std​::​move(base)[.](#1.sentence-1)
