24 Ranges library [ranges]

24.7 Range adaptors [range.adaptors]

24.7.12 Join view [range.join]

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

namespace std::ranges { template<input_­range V> requires view<V> && input_­range<range_reference_t<V>> class join_view : public view_interface<join_view<V>> { private: using InnerRng = range_reference_t<V>; // exposition only // [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 non-propagating-cache<remove_cv_t<InnerRng>> inner_; // exposition only, present only // when !is_­reference_­v<InnerRng> public: join_view() requires default_­initializable<V> = 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> && 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).