Init
This commit is contained in:
31
cppdraft/range/single/overview.md
Normal file
31
cppdraft/range/single/overview.md
Normal file
@@ -0,0 +1,31 @@
|
||||
[range.single.overview]
|
||||
|
||||
# 25 Ranges library [[ranges]](./#ranges)
|
||||
|
||||
## 25.6 Range factories [[range.factories]](range.factories#range.single.overview)
|
||||
|
||||
### 25.6.3 Single view [[range.single]](range.single#overview)
|
||||
|
||||
#### 25.6.3.1 Overview [range.single.overview]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2626)
|
||||
|
||||
single_view produces a view that contains
|
||||
exactly one element of a specified value[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2630)
|
||||
|
||||
The name views::single denotes a
|
||||
customization point object ([[customization.point.object]](customization.point.object "16.3.3.3.5 Customization Point Object types"))[.](#2.sentence-1)
|
||||
|
||||
Given a subexpression E, the expressionviews::single(E) is expression-equivalent tosingle_view<decay_t<decltype((E))>>(E)[.](#2.sentence-2)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2638)
|
||||
|
||||
[*Example [1](#example-1)*: for (int i : views::single(4)) cout << i; // prints 4 â *end example*]
|
||||
106
cppdraft/range/single/view.md
Normal file
106
cppdraft/range/single/view.md
Normal file
@@ -0,0 +1,106 @@
|
||||
[range.single.view]
|
||||
|
||||
# 25 Ranges library [[ranges]](./#ranges)
|
||||
|
||||
## 25.6 Range factories [[range.factories]](range.factories#range.single.view)
|
||||
|
||||
### 25.6.3 Single view [[range.single]](range.single#view)
|
||||
|
||||
#### 25.6.3.2 Class template single_view [range.single.view]
|
||||
|
||||
[ð](#lib:single_view)
|
||||
|
||||
namespace std::ranges {template<[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13 Concept move_constructible [concept.moveconstructible]") T>requires is_object_v<T>class single_view : public view_interface<single_view<T>> {private:*movable-box*<T> *value_*; // *exposition only* (see [[range.move.wrap]](range.move.wrap "25.7.3 Movable wrapper"))public: single_view() requires [default_initializable](concept.default.init#concept:default_initializable "18.4.12 Concept default_initializable [concept.default.init]")<T> = default; constexpr explicit single_view(const T& t) requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_constructible [concept.copyconstructible]")<T>; constexpr explicit single_view(T&& t); template<class... Args>requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_from [concept.constructible]")<T, Args...>constexpr explicit 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 bool empty() noexcept; static constexpr size_t size() noexcept; constexpr T* data() noexcept; constexpr const T* data() const noexcept; }; template<class T> single_view(T) -> single_view<T>;}
|
||||
|
||||
[ð](#lib:single_view,constructor)
|
||||
|
||||
`constexpr explicit single_view(const T& t) requires [copy_constructible](concept.copyconstructible#concept:copy_constructible "18.4.14 Concept copy_constructible [concept.copyconstructible]")<T>;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2686)
|
||||
|
||||
*Effects*: Initializes *value_* with t[.](#1.sentence-1)
|
||||
|
||||
[ð](#lib:single_view,constructor_)
|
||||
|
||||
`constexpr explicit single_view(T&& t);
|
||||
`
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2697)
|
||||
|
||||
*Effects*: Initializes *value_* with std::move(t)[.](#2.sentence-1)
|
||||
|
||||
[ð](#lib:single_view,constructor__)
|
||||
|
||||
`template<class... Args>
|
||||
requires [constructible_from](concept.constructible#concept:constructible_from "18.4.11 Concept constructible_from [concept.constructible]")<T, Args...>
|
||||
constexpr explicit single_view(in_place_t, Args&&... args);
|
||||
`
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2710)
|
||||
|
||||
*Effects*: Initializes *value_* as if by*value_*{in_place, std::forward<Args>(args)...}[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:begin,single_view)
|
||||
|
||||
`constexpr T* begin() noexcept;
|
||||
constexpr const T* begin() const noexcept;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2723)
|
||||
|
||||
*Effects*: Equivalent to: return data();
|
||||
|
||||
[ð](#lib:end,single_view)
|
||||
|
||||
`constexpr T* end() noexcept;
|
||||
constexpr const T* end() const noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2735)
|
||||
|
||||
*Effects*: Equivalent to: return data() + 1;
|
||||
|
||||
[ð](#lib:empty,single_view)
|
||||
|
||||
`static constexpr bool empty() noexcept;
|
||||
`
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2746)
|
||||
|
||||
*Effects*: Equivalent to: return false;
|
||||
|
||||
[ð](#lib:size,single_view)
|
||||
|
||||
`static constexpr size_t size() noexcept;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2757)
|
||||
|
||||
*Effects*: Equivalent to: return 1;
|
||||
|
||||
[ð](#lib:data,single_view)
|
||||
|
||||
`constexpr T* data() noexcept;
|
||||
constexpr const T* data() const noexcept;
|
||||
`
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L2769)
|
||||
|
||||
*Effects*: Equivalent to: return *value_*.operator->();
|
||||
Reference in New Issue
Block a user