From Jason Turner

[span.cons]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpneghqdyd/{from.md → to.md} +29 -14
tmp/tmpneghqdyd/{from.md → to.md} RENAMED
@@ -22,14 +22,15 @@ template<class It>
22
 
23
  *Preconditions:*
24
 
25
  - \[`first`, `first + count`) is a valid range.
26
  - `It` models `contiguous_iterator`.
27
- - If `extent` is not equal to `dynamic_extent`, then `count` is equal to
28
- `extent`.
29
 
30
- *Effects:* Initializes *`data_`* with `to_address(first)` and *`size_`*
 
 
 
31
  with `count`.
32
 
33
  *Throws:* Nothing.
34
 
35
  ``` cpp
@@ -46,28 +47,29 @@ template<class It, class End>
46
  - `End` satisfies `sized_sentinel_for<It>`.
47
  - `is_convertible_v<End, size_t>` is `false`.
48
 
49
  *Preconditions:*
50
 
51
- - If `extent` is not equal to `dynamic_extent`, then `last - first` is
52
- equal to `extent`.
53
  - \[`first`, `last`) is a valid range.
54
  - `It` models `contiguous_iterator`.
55
  - `End` models `sized_sentinel_for<It>`.
56
 
57
- *Effects:* Initializes *`data_`* with `to_address(first)` and *`size_`*
 
 
 
58
  with `last - first`.
59
 
60
  *Throws:* When and what `last - first` throws.
61
 
62
  ``` cpp
63
  template<size_t N> constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
64
  template<class T, size_t N> constexpr span(array<T, N>& arr) noexcept;
65
  template<class T, size_t N> constexpr span(const array<T, N>& arr) noexcept;
66
  ```
67
 
68
- *Constraints:* Let `U` be `remove_pointer_t<decltype(data(arr))>`.
69
 
70
  - `extent == dynamic_extent || N == extent` is `true`, and
71
  - `is_convertible_v<U(*)[], element_type(*)[]>` is `true`.
72
  \[*Note 3*: The intent is to allow only qualification conversions of
73
  the array element type to `element_type`. — *end note*]
@@ -75,11 +77,11 @@ template<class T, size_t N> constexpr span(const array<T, N>& arr) noexcept;
75
  *Effects:* Constructs a `span` that is a view over the supplied array.
76
 
77
  [*Note 1*: `type_identity_t` affects class template argument
78
  deduction. — *end note*]
79
 
80
- *Ensures:* `size() == N && data() == data(arr)` is `true`.
81
 
82
  ``` cpp
83
  template<class R> constexpr explicit(extent != dynamic_extent) span(R&& r);
84
  ```
85
 
@@ -96,21 +98,34 @@ template<class R> constexpr explicit(extent != dynamic_extent) span(R&& r);
96
  \[*Note 4*: The intent is to allow only qualification conversions of
97
  the range reference type to `element_type`. — *end note*]
98
 
99
  *Preconditions:*
100
 
101
- - If `extent` is not equal to `dynamic_extent`, then `ranges::size(r)`
102
- is equal to `extent`.
103
  - `R` models `ranges::contiguous_range` and `ranges::sized_range`.
104
  - If `is_const_v<element_type>` is `false`, `R` models
105
  `ranges::borrowed_range`.
106
 
107
- *Effects:* Initializes *`data_`* with `ranges::data(r)` and *`size_`*
108
- with `ranges::size(r)`.
 
 
 
109
 
110
  *Throws:* What and when `ranges::data(r)` and `ranges::size(r)` throw.
111
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  ``` cpp
113
  constexpr span(const span& other) noexcept = default;
114
  ```
115
 
116
  *Ensures:* `other.size() == size() && other.data() == data()`.
@@ -127,12 +142,12 @@ template<class OtherElementType, size_t OtherExtent>
127
  - `is_convertible_v<OtherElementType(*)[], element_type(*)[]>` is
128
  `true`. \[*Note 5*: The intent is to allow only qualification
129
  conversions of the `OtherElementType` to
130
  `element_type`. — *end note*]
131
 
132
- *Preconditions:* If `extent` is not equal to `dynamic_extent`, then
133
- `s.size()` is equal to `extent`.
134
 
135
  *Effects:* Constructs a `span` that is a view over the range
136
  \[`s.data()`, `s.data() + s.size()`).
137
 
138
  *Ensures:* `size() == s.size() && data() == s.data()`.
 
22
 
23
  *Preconditions:*
24
 
25
  - \[`first`, `first + count`) is a valid range.
26
  - `It` models `contiguous_iterator`.
 
 
27
 
28
+ If `extent` is not equal to `dynamic_extent`, then `count == extent` is
29
+ `true`.
30
+
31
+ *Effects:* Initializes *data\_* with `to_address(first)` and *size\_*
32
  with `count`.
33
 
34
  *Throws:* Nothing.
35
 
36
  ``` cpp
 
47
  - `End` satisfies `sized_sentinel_for<It>`.
48
  - `is_convertible_v<End, size_t>` is `false`.
49
 
50
  *Preconditions:*
51
 
 
 
52
  - \[`first`, `last`) is a valid range.
53
  - `It` models `contiguous_iterator`.
54
  - `End` models `sized_sentinel_for<It>`.
55
 
56
+ If `extent` is not equal to `dynamic_extent`, then
57
+ `(last - first) == extent` is `true`.
58
+
59
+ *Effects:* Initializes *data\_* with `to_address(first)` and *size\_*
60
  with `last - first`.
61
 
62
  *Throws:* When and what `last - first` throws.
63
 
64
  ``` cpp
65
  template<size_t N> constexpr span(type_identity_t<element_type> (&arr)[N]) noexcept;
66
  template<class T, size_t N> constexpr span(array<T, N>& arr) noexcept;
67
  template<class T, size_t N> constexpr span(const array<T, N>& arr) noexcept;
68
  ```
69
 
70
+ *Constraints:* Let `U` be `remove_pointer_t<decltype(std::data(arr))>`.
71
 
72
  - `extent == dynamic_extent || N == extent` is `true`, and
73
  - `is_convertible_v<U(*)[], element_type(*)[]>` is `true`.
74
  \[*Note 3*: The intent is to allow only qualification conversions of
75
  the array element type to `element_type`. — *end note*]
 
77
  *Effects:* Constructs a `span` that is a view over the supplied array.
78
 
79
  [*Note 1*: `type_identity_t` affects class template argument
80
  deduction. — *end note*]
81
 
82
+ *Ensures:* `size() == N && data() == std::data(arr)` is `true`.
83
 
84
  ``` cpp
85
  template<class R> constexpr explicit(extent != dynamic_extent) span(R&& r);
86
  ```
87
 
 
98
  \[*Note 4*: The intent is to allow only qualification conversions of
99
  the range reference type to `element_type`. — *end note*]
100
 
101
  *Preconditions:*
102
 
 
 
103
  - `R` models `ranges::contiguous_range` and `ranges::sized_range`.
104
  - If `is_const_v<element_type>` is `false`, `R` models
105
  `ranges::borrowed_range`.
106
 
107
+ If `extent` is not equal to `dynamic_extent`, then
108
+ `ranges::size(r) == extent` is `true`.
109
+
110
+ *Effects:* Initializes *data\_* with `ranges::data(r)` and *size\_* with
111
+ `ranges::size(r)`.
112
 
113
  *Throws:* What and when `ranges::data(r)` and `ranges::size(r)` throw.
114
 
115
+ ``` cpp
116
+ constexpr explicit(extent != dynamic_extent) span(std::initializer_list<value_type> il);
117
+ ```
118
+
119
+ *Constraints:* `is_const_v<element_type>` is `true`.
120
+
121
+ If `extent` is not equal to `dynamic_extent`, then `il.size() == extent`
122
+ is `true`.
123
+
124
+ *Effects:* Initializes *data\_* with `il.begin()` and *size\_* with
125
+ `il.size()`.
126
+
127
  ``` cpp
128
  constexpr span(const span& other) noexcept = default;
129
  ```
130
 
131
  *Ensures:* `other.size() == size() && other.data() == data()`.
 
142
  - `is_convertible_v<OtherElementType(*)[], element_type(*)[]>` is
143
  `true`. \[*Note 5*: The intent is to allow only qualification
144
  conversions of the `OtherElementType` to
145
  `element_type`. — *end note*]
146
 
147
+ If `extent` is not equal to `dynamic_extent`, then `s.size() == extent`
148
+ is `true`.
149
 
150
  *Effects:* Constructs a `span` that is a view over the range
151
  \[`s.data()`, `s.data() + s.size()`).
152
 
153
  *Ensures:* `size() == s.size() && data() == s.data()`.