88:icons: font
99:stem: latexmath
1010
11- = Map Span
11+ = Map View
1212
1313== Introduction
1414
15- The map span is a fixed-capacity associative span .
15+ The `map_view` template class is a fixed-capacity associative view .
1616
1717== Tutorial
1818
1919=== In-Place Construction
2020
21- Constructing an element in-place is done by expanding the span , constructing
21+ Constructing an element in-place is done by expanding the view , constructing
2222the element in the expanded storage, and reordering the constructed element.
2323
2424[source,c++,numbered]
2525----
26- map:: pair<std::string, int> storage[4] = {};
27- map::span <std::string, int> span (storage);
26+ pair<std::string, int> storage[4] = {};
27+ map_view <std::string, int> view (storage);
2828
29- assert(!span .full());
29+ assert(!view .full());
3030
31- auto position = span .expand_back();
31+ auto position = view .expand_back();
3232 std::construct_at(position, "key", 42); // Use placement-new before C++20
3333 position = reorder_back();
3434
35- assert(span .lower_bound("key") == position);
35+ assert(view .lower_bound("key") == position);
3636 assert(position->first == "key");
3737 assert(position->second == 42);
3838----
3939
4040
4141== Design Rationale
4242
43- This section describes the choice behind the design of the map span . See also
44- the general <<../ rationale.adoc#,span rationale>>.
43+ This section describes the choice behind the design of the map view . See also
44+ the general <<rationale.adoc#,view rationale>>.
4545
4646=== Non-copyable
4747
48- The map span is not copyable. If two spans are operating on the same underlying
48+ The map view is not copyable. If two views are operating on the same underlying
4949storage, then they may break the class invariants of each other. For instance,
50- if the first span removes an element (the removed element is moved to the position
51- immediately after the span ) then the second span looks at a range where its last
50+ if the first view removes an element (the removed element is moved to the position
51+ immediately after the view ) then the second view looks at a range where its last
5252element no longer is in the correct order.
5353
54- The map span is movable, but it is undefined behavior to use the moved-from span .
54+ The map view is movable, but it is undefined behavior to use the moved-from view .
5555
5656== Reference
5757
58- Defined in header `<vista/map/span .hpp>`.
58+ Defined in header `<vista/map_view .hpp>`.
5959
60- Defined in namespace `vista::map `.
60+ Defined in namespace `vista`.
6161[source,c++]
6262----
6363template <
6464 typename Key,
6565 typename T,
6666 std::size_t Extent = dynamic_extent,
6767 typename Compare = std::less<Key>>
68- > class span ;
68+ > class map_view ;
6969----
70- The map span template class is an associative array view of some continguos
71- storage. The storage is not owned by the span . The owner must ensure that the
72- span is destroyed before the storage is released.
70+ The map view template class is an associative array view of some continguos
71+ storage. The storage is not owned by the view . The owner must ensure that the
72+ view is destroyed before the storage is released.
7373
74- The map span does not construct or destroy elements in the underlying storage.
74+ The map view does not construct or destroy elements in the underlying storage.
7575Some operations may leave elements in a moved-from state.
7676
77- The size is the current number of elements in the span .
77+ The size is the current number of elements in the view .
7878
7979The capacity is the maximum number of elements that can be inserted. The
8080capacity cannot be changed.
8181
82- The extent determines the capacity of the span .
82+ The extent determines the capacity of the view .
8383With `dynamic_extent` the capacity is derived from the input arguments
8484at construction or assignment time. Otherwise the capacity is fixed to the
8585specified `Extent` template argument. Dynamic extent is used by default.
@@ -96,7 +96,7 @@ specified `Extent` template argument. Dynamic extent is used by default.
9696 +
9797 +
9898 _Constraint:_ `T` must be a complete type.
99- | `Extent` | The maximum number of elements in the span .
99+ | `Extent` | The maximum number of elements in the view .
100100| `Compare` | A _BinaryPredicate_ determining the order.
101101|===
102102
@@ -121,10 +121,10 @@ specified `Extent` template argument. Dynamic extent is used by default.
121121[%header,frame="topbot",grid="rows",stripes=none]
122122|===
123123| Member function | Description
124- | `constexpr span () noexcept` | Creates an empty map span with zero capacity.
124+ | `constexpr map_view () noexcept` | Creates an empty map view with zero capacity.
125125 +
126126 +
127- No elements can be inserted into a zero-capacity span . The span must
127+ No elements can be inserted into a zero-capacity view . The view must
128128 therefore be recreated before use.
129129 +
130130 +
@@ -134,21 +134,21 @@ specified `Extent` template argument. Dynamic extent is used by default.
134134 _Ensures:_ `capacity() == 0`
135135 +
136136 _Ensures:_ `size() == 0`
137- | `constexpr span(span && other) noexcept` | Creates span by moving.
137+ | `constexpr map_view(map_view && other) noexcept` | Creates view by moving.
138138 +
139139 +
140- The state of the moved-from span is valid but unspecified.
140+ The state of the moved-from view is valid but unspecified.
141141 +
142142 +
143143 _Ensures:_ `capacity() == other.capacity()`
144144 +
145145 _Ensures:_ `size() == other.size()`
146146| `template <std::size_t N>
147147 +
148- constexpr span (value_type (&array)[N]) noexcept` | Creates empty span from array.
148+ constexpr map_view (value_type (&array)[N]) noexcept` | Creates empty view from array.
149149 +
150150 +
151- The span uses the array as the underlying storage.
151+ The view uses the array as the underlying storage.
152152 +
153153 +
154154 _Constrait:_ `N == Extent` unless `Extent == dynamic_extent`
@@ -159,7 +159,7 @@ specified `Extent` template argument. Dynamic extent is used by default.
159159 _Ensures:_ `size() == 0`
160160| `template <typename ContiguousIterator>
161161 +
162- constexpr span (ContiguousIterator begin, ContiguousIterator end) noexcept` | Creates a span from iterators.
162+ constexpr map_view (ContiguousIterator begin, ContiguousIterator end) noexcept` | Creates a view from iterators.
163163 +
164164 +
165165 _Expects:_ `Extent == std::distance(begin, end)` or `Extent == dynamic_extent`
@@ -168,14 +168,14 @@ specified `Extent` template argument. Dynamic extent is used by default.
168168 _Ensures:_ `capacity() == std::distance(begin, end)`
169169 +
170170 _Ensures:_ `size() == 0`
171- | `constexpr bool empty() const noexcept` | Checks if span is empty.
172- | `constexpr bool full() const noexcept` | Checks if span is full.
171+ | `constexpr bool empty() const noexcept` | Checks if view is empty.
172+ | `constexpr bool full() const noexcept` | Checks if view is full.
173173 +
174174 +
175- Span is full when `size() == capacity()`.
176- | `constexpr size_type capacity() const noexcept` | Returns the maximum possible number of elements in the span .
177- | `constexpr size_type size() const noexcept` | Returns the number of elements in the span .
178- | `constexpr{wj}footnote:constexpr11[Not constexpr in pass:[C++11].] void clear() noexcept` | Clears the span .
175+ View is full when `size() == capacity()`.
176+ | `constexpr size_type capacity() const noexcept` | Returns the maximum possible number of elements in the view .
177+ | `constexpr size_type size() const noexcept` | Returns the number of elements in the view .
178+ | `constexpr{wj}footnote:constexpr11[Not constexpr in pass:[C++11].] void clear() noexcept` | Clears the view .
179179 +
180180 +
181181 The elements are not destroyed in the underlying storage.
@@ -203,17 +203,17 @@ specified `Extent` template argument. Dynamic extent is used by default.
203203 +
204204 +
205205 _Remarks:_ `noexcept` if `value_type` is nothrow _Swappable_.
206- | `constexpr{wj}footnote:constexpr11[] iterator expand_back() noexcept` | Inserts unspecified element at the end of the span .
206+ | `constexpr{wj}footnote:constexpr11[] iterator expand_back() noexcept` | Inserts unspecified element at the end of the view .
207207 +
208208 +
209- The span is expanded to include the next element in the underlying storage
209+ The view is expanded to include the next element in the underlying storage
210210 after the current end.
211211 +
212212 +
213213 Returns iterator to inserted element.
214214 +
215215 +
216- The span may not be expanded beyond capacity.
216+ The view may not be expanded beyond capacity.
217217 +
218218 +
219219 This function breaks the class invariants which must be restored with
@@ -251,15 +251,15 @@ specified `Extent` template argument. Dynamic extent is used by default.
251251 +
252252 +
253253 constexpr const_iterator cbegin() const noexcept`
254- | Returns an iterator to the beginning of the span .
254+ | Returns an iterator to the beginning of the view .
255255| `constexpr{wj}footnote:constexpr11[] iterator end() noexcept
256256 +
257257 +
258258 constexpr const_iterator end() const noexcept
259259 +
260260 +
261261 constexpr const_iterator cend() const noexcept`
262- | Returns an iterator to the end of the span .
262+ | Returns an iterator to the end of the view .
263263| `constexpr key_compare key_comp() const noexcept` | Returns key comparison predicate.
264264| `constexpr value_compare value_comp() const noexcept` | Returns value comparison predicate.
265265|===
0 commit comments