24 Ranges library [ranges]

24.6 Range factories [range.factories]

24.6.3 Single view [range.single]

24.6.3.2 Class template single_­view [range.single.view]

namespace std::ranges { template<copy_­constructible T> requires is_object_v<T> class single_view : public view_interface<single_view<T>> { private: semiregular-box<T> value_; // exposition only (see [range.semi.wrap]) public: single_view() = default; constexpr explicit single_view(const T& t); constexpr explicit single_view(T&& t); template<class... Args> requires constructible_­from<T, Args...> constexpr single_view(in_place_t, Args&&... args); constexpr T* begin() noexcept; constexpr const T* begin() const noexcept; constexpr T* end() noexcept; constexpr const T* end() const noexcept; static constexpr size_t size() noexcept; constexpr T* data() noexcept; constexpr const T* data() const noexcept; }; }
constexpr explicit single_view(const T& t);
Effects: Initializes value_­ with t.
constexpr explicit single_view(T&& t);
Effects: Initializes value_­ with std​::​move(t).
template<class... Args> requires constructible_­from<T, Args...> constexpr single_view(in_place_t, Args&&... args);
Effects: Initializes value_­ as if by value_­{in_­place, std​::​forward<Args>(args)...}.
constexpr T* begin() noexcept; constexpr const T* begin() const noexcept;
Effects: Equivalent to: return data();
constexpr T* end() noexcept; constexpr const T* end() const noexcept;
Effects: Equivalent to: return data() + 1;
static constexpr size_t size() noexcept;
Effects: Equivalent to: return 1;
constexpr T* data() noexcept; constexpr const T* data() const noexcept;
Effects: Equivalent to: return value_­.operator->();