24 Ranges library [ranges]

24.7 Range adaptors [range.adaptors]

24.7.11 Join view [range.join]

24.7.11.2 Class template join_­view [range.join.view]

namespace std::ranges { template<input_­range V> requires view<V> && input_­range<range_reference_t<V>> && (is_reference_v<range_reference_t<V>> || view<range_value_t<V>>) class join_view : public view_interface<join_view<V>> { private: using InnerRng = // exposition only range_reference_t<V>; // [range.join.iterator], class template join_­view​::​iterator template<bool Const> struct iterator; // exposition only // [range.join.sentinel], class template join_­view​::​sentinel template<bool Const> struct sentinel; // exposition only V base_ = V(); // exposition only views::all_t<InnerRng> inner_ = // exposition only, present only when !is_­reference_­v<InnerRng> views::all_t<InnerRng>(); public: join_view() = default; constexpr explicit join_view(V base); constexpr V base() const& requires copy_­constructible<V> { return base_; } constexpr V base() && { return std::move(base_); } constexpr auto begin() { constexpr bool use_const = simple-view<V> && is_reference_v<range_reference_t<V>>; return iterator<use_const>{*this, ranges::begin(base_)}; } constexpr auto begin() const requires input_­range<const V> && is_reference_v<range_reference_t<const V>> { return iterator<true>{*this, ranges::begin(base_)}; } constexpr auto end() { if constexpr (forward_­range<V> && is_reference_v<InnerRng> && forward_­range<InnerRng> && common_range<V> && common_range<InnerRng>) return iterator<simple-view<V>>{*this, ranges::end(base_)}; else return sentinel<simple-view<V>>{*this}; } constexpr auto end() const requires input_­range<const V> && is_reference_v<range_reference_t<const V>> { if constexpr (forward_­range<const V> && is_reference_v<range_reference_t<const V>> && forward_­range<range_reference_t<const V>> && common_range<const V> && common_range<range_reference_t<const V>>) return iterator<true>{*this, ranges::end(base_)}; else return sentinel<true>{*this}; } }; template<class R> explicit join_view(R&&) -> join_view<views::all_t<R>>; }
constexpr explicit join_view(V base);
Effects: Initializes base_­ with std​::​move(base).