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_;
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>
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->();