Chris@16
|
1 // Boost.Container static_vector
|
Chris@16
|
2 //
|
Chris@16
|
3 // Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
|
Chris@16
|
4 // Copyright (c) 2011-2013 Andrew Hundt.
|
Chris@16
|
5 //
|
Chris@16
|
6 // Use, modification and distribution is subject to the Boost Software License,
|
Chris@16
|
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
8 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
9
|
Chris@16
|
10 #ifndef BOOST_CONTAINER_STATIC_VECTOR_HPP
|
Chris@16
|
11 #define BOOST_CONTAINER_STATIC_VECTOR_HPP
|
Chris@16
|
12
|
Chris@16
|
13 #if defined(_MSC_VER)
|
Chris@16
|
14 # pragma once
|
Chris@16
|
15 #endif
|
Chris@16
|
16
|
Chris@16
|
17 #include <boost/container/detail/config_begin.hpp>
|
Chris@16
|
18
|
Chris@16
|
19 #include <boost/container/vector.hpp>
|
Chris@16
|
20 #include <boost/aligned_storage.hpp>
|
Chris@16
|
21
|
Chris@16
|
22 namespace boost { namespace container {
|
Chris@16
|
23
|
Chris@16
|
24 namespace container_detail {
|
Chris@16
|
25
|
Chris@16
|
26 template<class T, std::size_t N>
|
Chris@16
|
27 class static_storage_allocator
|
Chris@16
|
28 {
|
Chris@16
|
29 public:
|
Chris@16
|
30 typedef T value_type;
|
Chris@16
|
31
|
Chris@16
|
32 static_storage_allocator() BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
33 {}
|
Chris@16
|
34
|
Chris@16
|
35 static_storage_allocator(const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
36 {}
|
Chris@16
|
37
|
Chris@16
|
38 static_storage_allocator & operator=(const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
39 {}
|
Chris@16
|
40
|
Chris@16
|
41 T* internal_storage() const BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
42 { return const_cast<T*>(static_cast<const T*>(static_cast<const void*>(&storage))); }
|
Chris@16
|
43
|
Chris@16
|
44 T* internal_storage() BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
45 { return static_cast<T*>(static_cast<void*>(&storage)); }
|
Chris@16
|
46
|
Chris@16
|
47 static const std::size_t internal_capacity = N;
|
Chris@16
|
48
|
Chris@16
|
49 typedef boost::container::container_detail::version_type<static_storage_allocator, 0> version;
|
Chris@16
|
50
|
Chris@16
|
51 friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
52 { return false; }
|
Chris@16
|
53
|
Chris@16
|
54 friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
55 { return true; }
|
Chris@16
|
56
|
Chris@16
|
57 private:
|
Chris@16
|
58 typename boost::aligned_storage
|
Chris@16
|
59 <sizeof(T)*N, boost::alignment_of<T>::value>::type storage;
|
Chris@16
|
60 };
|
Chris@16
|
61
|
Chris@16
|
62 } //namespace container_detail {
|
Chris@16
|
63
|
Chris@16
|
64 /**
|
Chris@16
|
65 * @defgroup static_vector_non_member static_vector non-member functions
|
Chris@16
|
66 */
|
Chris@16
|
67
|
Chris@16
|
68 /**
|
Chris@16
|
69 * @brief A variable-size array container with fixed capacity.
|
Chris@16
|
70 *
|
Chris@16
|
71 * static_vector is a sequence container like boost::container::vector with contiguous storage that can
|
Chris@16
|
72 * change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
|
Chris@16
|
73 *
|
Chris@16
|
74 * A static_vector is a sequence that supports random access to elements, constant time insertion and
|
Chris@16
|
75 * removal of elements at the end, and linear time insertion and removal of elements at the beginning or
|
Chris@16
|
76 * in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity
|
Chris@16
|
77 * because elements are stored within the object itself similarly to an array. However, objects are
|
Chris@16
|
78 * initialized as they are inserted into static_vector unlike C arrays or std::array which must construct
|
Chris@16
|
79 * all elements on instantiation. The behavior of static_vector enables the use of statically allocated
|
Chris@16
|
80 * elements in cases with complex object lifetime requirements that would otherwise not be trivially
|
Chris@16
|
81 * possible.
|
Chris@16
|
82 *
|
Chris@16
|
83 * @par Error Handling
|
Chris@16
|
84 * Insertion beyond the capacity result in throwing std::bad_alloc() if exceptions are enabled or
|
Chris@16
|
85 * calling throw_bad_alloc() if not enabled.
|
Chris@16
|
86 *
|
Chris@16
|
87 * std::out_of_range is thrown if out of bound access is performed in `at()` if exceptions are
|
Chris@16
|
88 * enabled, throw_out_of_range() if not enabled.
|
Chris@16
|
89 *
|
Chris@16
|
90 * @tparam Value The type of element that will be stored.
|
Chris@16
|
91 * @tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
|
Chris@16
|
92 */
|
Chris@16
|
93 template <typename Value, std::size_t Capacity>
|
Chris@16
|
94 class static_vector
|
Chris@16
|
95 : public vector<Value, container_detail::static_storage_allocator<Value, Capacity> >
|
Chris@16
|
96 {
|
Chris@16
|
97 typedef vector<Value, container_detail::static_storage_allocator<Value, Capacity> > base_t;
|
Chris@16
|
98
|
Chris@16
|
99 BOOST_COPYABLE_AND_MOVABLE(static_vector)
|
Chris@16
|
100
|
Chris@16
|
101 template<class U, std::size_t OtherCapacity>
|
Chris@16
|
102 friend class static_vector;
|
Chris@16
|
103
|
Chris@16
|
104 public:
|
Chris@16
|
105 //! @brief The type of elements stored in the container.
|
Chris@16
|
106 typedef typename base_t::value_type value_type;
|
Chris@16
|
107 //! @brief The unsigned integral type used by the container.
|
Chris@16
|
108 typedef typename base_t::size_type size_type;
|
Chris@16
|
109 //! @brief The pointers difference type.
|
Chris@16
|
110 typedef typename base_t::difference_type difference_type;
|
Chris@16
|
111 //! @brief The pointer type.
|
Chris@16
|
112 typedef typename base_t::pointer pointer;
|
Chris@16
|
113 //! @brief The const pointer type.
|
Chris@16
|
114 typedef typename base_t::const_pointer const_pointer;
|
Chris@16
|
115 //! @brief The value reference type.
|
Chris@16
|
116 typedef typename base_t::reference reference;
|
Chris@16
|
117 //! @brief The value const reference type.
|
Chris@16
|
118 typedef typename base_t::const_reference const_reference;
|
Chris@16
|
119 //! @brief The iterator type.
|
Chris@16
|
120 typedef typename base_t::iterator iterator;
|
Chris@16
|
121 //! @brief The const iterator type.
|
Chris@16
|
122 typedef typename base_t::const_iterator const_iterator;
|
Chris@16
|
123 //! @brief The reverse iterator type.
|
Chris@16
|
124 typedef typename base_t::reverse_iterator reverse_iterator;
|
Chris@16
|
125 //! @brief The const reverse iterator.
|
Chris@16
|
126 typedef typename base_t::const_reverse_iterator const_reverse_iterator;
|
Chris@16
|
127
|
Chris@16
|
128 //! @brief Constructs an empty static_vector.
|
Chris@16
|
129 //!
|
Chris@16
|
130 //! @par Throws
|
Chris@16
|
131 //! Nothing.
|
Chris@16
|
132 //!
|
Chris@16
|
133 //! @par Complexity
|
Chris@16
|
134 //! Constant O(1).
|
Chris@16
|
135 static_vector() BOOST_CONTAINER_NOEXCEPT
|
Chris@16
|
136 : base_t()
|
Chris@16
|
137 {}
|
Chris@16
|
138
|
Chris@16
|
139 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
140 //!
|
Chris@16
|
141 //! @brief Constructs a static_vector containing count value initialized values.
|
Chris@16
|
142 //!
|
Chris@16
|
143 //! @param count The number of values which will be contained in the container.
|
Chris@16
|
144 //!
|
Chris@16
|
145 //! @par Throws
|
Chris@16
|
146 //! If Value's default constructor throws.
|
Chris@16
|
147 //!
|
Chris@16
|
148 //! @par Complexity
|
Chris@16
|
149 //! Linear O(N).
|
Chris@16
|
150 explicit static_vector(size_type count)
|
Chris@16
|
151 : base_t(count)
|
Chris@16
|
152 {}
|
Chris@16
|
153
|
Chris@16
|
154 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
155 //!
|
Chris@16
|
156 //! @brief Constructs a static_vector containing count value initialized values.
|
Chris@16
|
157 //!
|
Chris@16
|
158 //! @param count The number of values which will be contained in the container.
|
Chris@16
|
159 //!
|
Chris@16
|
160 //! @par Throws
|
Chris@16
|
161 //! If Value's default constructor throws.
|
Chris@16
|
162 //!
|
Chris@16
|
163 //! @par Complexity
|
Chris@16
|
164 //! Linear O(N).
|
Chris@16
|
165 //!
|
Chris@16
|
166 //! @par Note
|
Chris@16
|
167 //! Non-standard extension
|
Chris@16
|
168 static_vector(size_type count, default_init_t)
|
Chris@16
|
169 : base_t(count, default_init_t())
|
Chris@16
|
170 {}
|
Chris@16
|
171
|
Chris@16
|
172 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
173 //!
|
Chris@16
|
174 //! @brief Constructs a static_vector containing count copies of value.
|
Chris@16
|
175 //!
|
Chris@16
|
176 //! @param count The number of copies of a values that will be contained in the container.
|
Chris@16
|
177 //! @param value The value which will be used to copy construct values.
|
Chris@16
|
178 //!
|
Chris@16
|
179 //! @par Throws
|
Chris@16
|
180 //! If Value's copy constructor throws.
|
Chris@16
|
181 //!
|
Chris@16
|
182 //! @par Complexity
|
Chris@16
|
183 //! Linear O(N).
|
Chris@16
|
184 static_vector(size_type count, value_type const& value)
|
Chris@16
|
185 : base_t(count, value)
|
Chris@16
|
186 {}
|
Chris@16
|
187
|
Chris@16
|
188 //! @pre
|
Chris@16
|
189 //! @li <tt>distance(first, last) <= capacity()</tt>
|
Chris@16
|
190 //! @li Iterator must meet the \c ForwardTraversalIterator concept.
|
Chris@16
|
191 //!
|
Chris@16
|
192 //! @brief Constructs a static_vector containing copy of a range <tt>[first, last)</tt>.
|
Chris@16
|
193 //!
|
Chris@16
|
194 //! @param first The iterator to the first element in range.
|
Chris@16
|
195 //! @param last The iterator to the one after the last element in range.
|
Chris@16
|
196 //!
|
Chris@16
|
197 //! @par Throws
|
Chris@16
|
198 //! If Value's constructor taking a dereferenced Iterator throws.
|
Chris@16
|
199 //!
|
Chris@16
|
200 //! @par Complexity
|
Chris@16
|
201 //! Linear O(N).
|
Chris@16
|
202 template <typename Iterator>
|
Chris@16
|
203 static_vector(Iterator first, Iterator last)
|
Chris@16
|
204 : base_t(first, last)
|
Chris@16
|
205 {}
|
Chris@16
|
206
|
Chris@16
|
207 //! @brief Constructs a copy of other static_vector.
|
Chris@16
|
208 //!
|
Chris@16
|
209 //! @param other The static_vector which content will be copied to this one.
|
Chris@16
|
210 //!
|
Chris@16
|
211 //! @par Throws
|
Chris@16
|
212 //! If Value's copy constructor throws.
|
Chris@16
|
213 //!
|
Chris@16
|
214 //! @par Complexity
|
Chris@16
|
215 //! Linear O(N).
|
Chris@16
|
216 static_vector(static_vector const& other)
|
Chris@16
|
217 : base_t(other)
|
Chris@16
|
218 {}
|
Chris@16
|
219
|
Chris@16
|
220 //! @pre <tt>other.size() <= capacity()</tt>.
|
Chris@16
|
221 //!
|
Chris@16
|
222 //! @brief Constructs a copy of other static_vector.
|
Chris@16
|
223 //!
|
Chris@16
|
224 //! @param other The static_vector which content will be copied to this one.
|
Chris@16
|
225 //!
|
Chris@16
|
226 //! @par Throws
|
Chris@16
|
227 //! If Value's copy constructor throws.
|
Chris@16
|
228 //!
|
Chris@16
|
229 //! @par Complexity
|
Chris@16
|
230 //! Linear O(N).
|
Chris@16
|
231 template <std::size_t C>
|
Chris@16
|
232 static_vector(static_vector<value_type, C> const& other) : base_t(other) {}
|
Chris@16
|
233
|
Chris@16
|
234 //! @brief Copy assigns Values stored in the other static_vector to this one.
|
Chris@16
|
235 //!
|
Chris@16
|
236 //! @param other The static_vector which content will be copied to this one.
|
Chris@16
|
237 //!
|
Chris@16
|
238 //! @par Throws
|
Chris@16
|
239 //! If Value's copy constructor or copy assignment throws.
|
Chris@16
|
240 //!
|
Chris@16
|
241 //! @par Complexity
|
Chris@16
|
242 //! Linear O(N).
|
Chris@16
|
243 static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other)
|
Chris@16
|
244 {
|
Chris@16
|
245 base_t::operator=(static_cast<base_t const&>(other));
|
Chris@16
|
246 return *this;
|
Chris@16
|
247 }
|
Chris@16
|
248
|
Chris@16
|
249 //! @pre <tt>other.size() <= capacity()</tt>
|
Chris@16
|
250 //!
|
Chris@16
|
251 //! @brief Copy assigns Values stored in the other static_vector to this one.
|
Chris@16
|
252 //!
|
Chris@16
|
253 //! @param other The static_vector which content will be copied to this one.
|
Chris@16
|
254 //!
|
Chris@16
|
255 //! @par Throws
|
Chris@16
|
256 //! If Value's copy constructor or copy assignment throws.
|
Chris@16
|
257 //!
|
Chris@16
|
258 //! @par Complexity
|
Chris@16
|
259 //! Linear O(N).
|
Chris@16
|
260 template <std::size_t C>
|
Chris@16
|
261 // TEMPORARY WORKAROUND
|
Chris@16
|
262 #if defined(BOOST_NO_RVALUE_REFERENCES)
|
Chris@16
|
263 static_vector & operator=(::boost::rv< static_vector<value_type, C> > const& other)
|
Chris@16
|
264 #else
|
Chris@16
|
265 static_vector & operator=(static_vector<value_type, C> const& other)
|
Chris@16
|
266 #endif
|
Chris@16
|
267 {
|
Chris@16
|
268 base_t::operator=(static_cast<static_vector<value_type, C> const&>(other));
|
Chris@16
|
269 return *this;
|
Chris@16
|
270 }
|
Chris@16
|
271
|
Chris@16
|
272 //! @brief Move constructor. Moves Values stored in the other static_vector to this one.
|
Chris@16
|
273 //!
|
Chris@16
|
274 //! @param other The static_vector which content will be moved to this one.
|
Chris@16
|
275 //!
|
Chris@16
|
276 //! @par Throws
|
Chris@16
|
277 //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
|
Chris@16
|
278 //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
|
Chris@16
|
279 //!
|
Chris@16
|
280 //! @par Complexity
|
Chris@16
|
281 //! Linear O(N).
|
Chris@16
|
282 static_vector(BOOST_RV_REF(static_vector) other)
|
Chris@16
|
283 : base_t(boost::move(static_cast<base_t&>(other)))
|
Chris@16
|
284 {}
|
Chris@16
|
285
|
Chris@16
|
286 //! @pre <tt>other.size() <= capacity()</tt>
|
Chris@16
|
287 //!
|
Chris@16
|
288 //! @brief Move constructor. Moves Values stored in the other static_vector to this one.
|
Chris@16
|
289 //!
|
Chris@16
|
290 //! @param other The static_vector which content will be moved to this one.
|
Chris@16
|
291 //!
|
Chris@16
|
292 //! @par Throws
|
Chris@16
|
293 //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
|
Chris@16
|
294 //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
|
Chris@16
|
295 //!
|
Chris@16
|
296 //! @par Complexity
|
Chris@16
|
297 //! Linear O(N).
|
Chris@16
|
298 template <std::size_t C>
|
Chris@16
|
299 static_vector(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
|
Chris@16
|
300 : base_t(boost::move(static_cast<typename static_vector<value_type, C>::base_t&>(other)))
|
Chris@16
|
301 {}
|
Chris@16
|
302
|
Chris@16
|
303 //! @brief Move assignment. Moves Values stored in the other static_vector to this one.
|
Chris@16
|
304 //!
|
Chris@16
|
305 //! @param other The static_vector which content will be moved to this one.
|
Chris@16
|
306 //!
|
Chris@16
|
307 //! @par Throws
|
Chris@16
|
308 //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
|
Chris@16
|
309 //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
|
Chris@16
|
310 //!
|
Chris@16
|
311 //! @par Complexity
|
Chris@16
|
312 //! Linear O(N).
|
Chris@16
|
313 static_vector & operator=(BOOST_RV_REF(static_vector) other)
|
Chris@16
|
314 {
|
Chris@16
|
315 base_t::operator=(boost::move(static_cast<base_t&>(other)));
|
Chris@16
|
316 return *this;
|
Chris@16
|
317 }
|
Chris@16
|
318
|
Chris@16
|
319 //! @pre <tt>other.size() <= capacity()</tt>
|
Chris@16
|
320 //!
|
Chris@16
|
321 //! @brief Move assignment. Moves Values stored in the other static_vector to this one.
|
Chris@16
|
322 //!
|
Chris@16
|
323 //! @param other The static_vector which content will be moved to this one.
|
Chris@16
|
324 //!
|
Chris@16
|
325 //! @par Throws
|
Chris@16
|
326 //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
|
Chris@16
|
327 //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
|
Chris@16
|
328 //!
|
Chris@16
|
329 //! @par Complexity
|
Chris@16
|
330 //! Linear O(N).
|
Chris@16
|
331 template <std::size_t C>
|
Chris@16
|
332 static_vector & operator=(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
|
Chris@16
|
333 {
|
Chris@16
|
334 base_t::operator=(boost::move(static_cast<typename static_vector<value_type, C>::base_t&>(other)));
|
Chris@16
|
335 return *this;
|
Chris@16
|
336 }
|
Chris@16
|
337
|
Chris@16
|
338 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
Chris@16
|
339
|
Chris@16
|
340 //! @brief Destructor. Destroys Values stored in this container.
|
Chris@16
|
341 //!
|
Chris@16
|
342 //! @par Throws
|
Chris@16
|
343 //! Nothing
|
Chris@16
|
344 //!
|
Chris@16
|
345 //! @par Complexity
|
Chris@16
|
346 //! Linear O(N).
|
Chris@16
|
347 ~static_vector();
|
Chris@16
|
348
|
Chris@16
|
349 //! @brief Swaps contents of the other static_vector and this one.
|
Chris@16
|
350 //!
|
Chris@16
|
351 //! @param other The static_vector which content will be swapped with this one's content.
|
Chris@16
|
352 //!
|
Chris@16
|
353 //! @par Throws
|
Chris@16
|
354 //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
|
Chris@16
|
355 //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
|
Chris@16
|
356 //!
|
Chris@16
|
357 //! @par Complexity
|
Chris@16
|
358 //! Linear O(N).
|
Chris@16
|
359 void swap(static_vector & other);
|
Chris@16
|
360
|
Chris@16
|
361 //! @pre <tt>other.size() <= capacity() && size() <= other.capacity()</tt>
|
Chris@16
|
362 //!
|
Chris@16
|
363 //! @brief Swaps contents of the other static_vector and this one.
|
Chris@16
|
364 //!
|
Chris@16
|
365 //! @param other The static_vector which content will be swapped with this one's content.
|
Chris@16
|
366 //!
|
Chris@16
|
367 //! @par Throws
|
Chris@16
|
368 //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
|
Chris@16
|
369 //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
|
Chris@16
|
370 //!
|
Chris@16
|
371 //! @par Complexity
|
Chris@16
|
372 //! Linear O(N).
|
Chris@16
|
373 template <std::size_t C>
|
Chris@16
|
374 void swap(static_vector<value_type, C> & other);
|
Chris@16
|
375
|
Chris@16
|
376 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
377 //!
|
Chris@16
|
378 //! @brief Inserts or erases elements at the end such that
|
Chris@16
|
379 //! the size becomes count. New elements are value initialized.
|
Chris@16
|
380 //!
|
Chris@16
|
381 //! @param count The number of elements which will be stored in the container.
|
Chris@16
|
382 //!
|
Chris@16
|
383 //! @par Throws
|
Chris@16
|
384 //! If Value's default constructor throws.
|
Chris@16
|
385 //!
|
Chris@16
|
386 //! @par Complexity
|
Chris@16
|
387 //! Linear O(N).
|
Chris@16
|
388 void resize(size_type count);
|
Chris@16
|
389
|
Chris@16
|
390 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
391 //!
|
Chris@16
|
392 //! @brief Inserts or erases elements at the end such that
|
Chris@16
|
393 //! the size becomes count. New elements are default initialized.
|
Chris@16
|
394 //!
|
Chris@16
|
395 //! @param count The number of elements which will be stored in the container.
|
Chris@16
|
396 //!
|
Chris@16
|
397 //! @par Throws
|
Chris@16
|
398 //! If Value's default constructor throws.
|
Chris@16
|
399 //!
|
Chris@16
|
400 //! @par Complexity
|
Chris@16
|
401 //! Linear O(N).
|
Chris@16
|
402 //!
|
Chris@16
|
403 //! @par Note
|
Chris@16
|
404 //! Non-standard extension
|
Chris@16
|
405 void resize(size_type count, default_init_t);
|
Chris@16
|
406
|
Chris@16
|
407 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
408 //!
|
Chris@16
|
409 //! @brief Inserts or erases elements at the end such that
|
Chris@16
|
410 //! the size becomes count. New elements are copy constructed from value.
|
Chris@16
|
411 //!
|
Chris@16
|
412 //! @param count The number of elements which will be stored in the container.
|
Chris@16
|
413 //! @param value The value used to copy construct the new element.
|
Chris@16
|
414 //!
|
Chris@16
|
415 //! @par Throws
|
Chris@16
|
416 //! If Value's copy constructor throws.
|
Chris@16
|
417 //!
|
Chris@16
|
418 //! @par Complexity
|
Chris@16
|
419 //! Linear O(N).
|
Chris@16
|
420 void resize(size_type count, value_type const& value);
|
Chris@16
|
421
|
Chris@16
|
422 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
423 //!
|
Chris@16
|
424 //! @brief This call has no effect because the Capacity of this container is constant.
|
Chris@16
|
425 //!
|
Chris@16
|
426 //! @param count The number of elements which the container should be able to contain.
|
Chris@16
|
427 //!
|
Chris@16
|
428 //! @par Throws
|
Chris@16
|
429 //! Nothing.
|
Chris@16
|
430 //!
|
Chris@16
|
431 //! @par Complexity
|
Chris@16
|
432 //! Linear O(N).
|
Chris@16
|
433 void reserve(size_type count) BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
434
|
Chris@16
|
435 //! @pre <tt>size() < capacity()</tt>
|
Chris@16
|
436 //!
|
Chris@16
|
437 //! @brief Adds a copy of value at the end.
|
Chris@16
|
438 //!
|
Chris@16
|
439 //! @param value The value used to copy construct the new element.
|
Chris@16
|
440 //!
|
Chris@16
|
441 //! @par Throws
|
Chris@16
|
442 //! If Value's copy constructor throws.
|
Chris@16
|
443 //!
|
Chris@16
|
444 //! @par Complexity
|
Chris@16
|
445 //! Constant O(1).
|
Chris@16
|
446 void push_back(value_type const& value);
|
Chris@16
|
447
|
Chris@16
|
448 //! @pre <tt>size() < capacity()</tt>
|
Chris@16
|
449 //!
|
Chris@16
|
450 //! @brief Moves value to the end.
|
Chris@16
|
451 //!
|
Chris@16
|
452 //! @param value The value to move construct the new element.
|
Chris@16
|
453 //!
|
Chris@16
|
454 //! @par Throws
|
Chris@16
|
455 //! If Value's move constructor throws.
|
Chris@16
|
456 //!
|
Chris@16
|
457 //! @par Complexity
|
Chris@16
|
458 //! Constant O(1).
|
Chris@16
|
459 void push_back(BOOST_RV_REF(value_type) value);
|
Chris@16
|
460
|
Chris@16
|
461 //! @pre <tt>!empty()</tt>
|
Chris@16
|
462 //!
|
Chris@16
|
463 //! @brief Destroys last value and decreases the size.
|
Chris@16
|
464 //!
|
Chris@16
|
465 //! @par Throws
|
Chris@16
|
466 //! Nothing by default.
|
Chris@16
|
467 //!
|
Chris@16
|
468 //! @par Complexity
|
Chris@16
|
469 //! Constant O(1).
|
Chris@16
|
470 void pop_back();
|
Chris@16
|
471
|
Chris@16
|
472 //! @pre
|
Chris@16
|
473 //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
|
Chris@16
|
474 //! @li <tt>size() < capacity()</tt>
|
Chris@16
|
475 //!
|
Chris@16
|
476 //! @brief Inserts a copy of element at position.
|
Chris@16
|
477 //!
|
Chris@16
|
478 //! @param position The position at which the new value will be inserted.
|
Chris@16
|
479 //! @param value The value used to copy construct the new element.
|
Chris@16
|
480 //!
|
Chris@16
|
481 //! @par Throws
|
Chris@16
|
482 //! @li If Value's copy constructor or copy assignment throws
|
Chris@16
|
483 //! @li If Value's move constructor or move assignment throws.
|
Chris@16
|
484 //!
|
Chris@16
|
485 //! @par Complexity
|
Chris@16
|
486 //! Constant or linear.
|
Chris@16
|
487 iterator insert(iterator position, value_type const& value);
|
Chris@16
|
488
|
Chris@16
|
489 //! @pre
|
Chris@16
|
490 //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
|
Chris@16
|
491 //! @li <tt>size() < capacity()</tt>
|
Chris@16
|
492 //!
|
Chris@16
|
493 //! @brief Inserts a move-constructed element at position.
|
Chris@16
|
494 //!
|
Chris@16
|
495 //! @param position The position at which the new value will be inserted.
|
Chris@16
|
496 //! @param value The value used to move construct the new element.
|
Chris@16
|
497 //!
|
Chris@16
|
498 //! @par Throws
|
Chris@16
|
499 //! If Value's move constructor or move assignment throws.
|
Chris@16
|
500 //!
|
Chris@16
|
501 //! @par Complexity
|
Chris@16
|
502 //! Constant or linear.
|
Chris@16
|
503 iterator insert(iterator position, BOOST_RV_REF(value_type) value);
|
Chris@16
|
504
|
Chris@16
|
505 //! @pre
|
Chris@16
|
506 //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
|
Chris@16
|
507 //! @li <tt>size() + count <= capacity()</tt>
|
Chris@16
|
508 //!
|
Chris@16
|
509 //! @brief Inserts a count copies of value at position.
|
Chris@16
|
510 //!
|
Chris@16
|
511 //! @param position The position at which new elements will be inserted.
|
Chris@16
|
512 //! @param count The number of new elements which will be inserted.
|
Chris@16
|
513 //! @param value The value used to copy construct new elements.
|
Chris@16
|
514 //!
|
Chris@16
|
515 //! @par Throws
|
Chris@16
|
516 //! @li If Value's copy constructor or copy assignment throws.
|
Chris@16
|
517 //! @li If Value's move constructor or move assignment throws.
|
Chris@16
|
518 //!
|
Chris@16
|
519 //! @par Complexity
|
Chris@16
|
520 //! Linear O(N).
|
Chris@16
|
521 iterator insert(iterator position, size_type count, value_type const& value);
|
Chris@16
|
522
|
Chris@16
|
523 //! @pre
|
Chris@16
|
524 //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
|
Chris@16
|
525 //! @li <tt>distance(first, last) <= capacity()</tt>
|
Chris@16
|
526 //! @li \c Iterator must meet the \c ForwardTraversalIterator concept.
|
Chris@16
|
527 //!
|
Chris@16
|
528 //! @brief Inserts a copy of a range <tt>[first, last)</tt> at position.
|
Chris@16
|
529 //!
|
Chris@16
|
530 //! @param position The position at which new elements will be inserted.
|
Chris@16
|
531 //! @param first The iterator to the first element of a range used to construct new elements.
|
Chris@16
|
532 //! @param last The iterator to the one after the last element of a range used to construct new elements.
|
Chris@16
|
533 //!
|
Chris@16
|
534 //! @par Throws
|
Chris@16
|
535 //! @li If Value's constructor and assignment taking a dereferenced \c Iterator.
|
Chris@16
|
536 //! @li If Value's move constructor or move assignment throws.
|
Chris@16
|
537 //!
|
Chris@16
|
538 //! @par Complexity
|
Chris@16
|
539 //! Linear O(N).
|
Chris@16
|
540 template <typename Iterator>
|
Chris@16
|
541 iterator insert(iterator position, Iterator first, Iterator last);
|
Chris@16
|
542
|
Chris@16
|
543 //! @pre \c position must be a valid iterator of \c *this in range <tt>[begin(), end())</tt>
|
Chris@16
|
544 //!
|
Chris@16
|
545 //! @brief Erases Value from position.
|
Chris@16
|
546 //!
|
Chris@16
|
547 //! @param position The position of the element which will be erased from the container.
|
Chris@16
|
548 //!
|
Chris@16
|
549 //! @par Throws
|
Chris@16
|
550 //! If Value's move assignment throws.
|
Chris@16
|
551 //!
|
Chris@16
|
552 //! @par Complexity
|
Chris@16
|
553 //! Linear O(N).
|
Chris@16
|
554 iterator erase(iterator position);
|
Chris@16
|
555
|
Chris@16
|
556 //! @pre
|
Chris@16
|
557 //! @li \c first and \c last must define a valid range
|
Chris@16
|
558 //! @li iterators must be in range <tt>[begin(), end()]</tt>
|
Chris@16
|
559 //!
|
Chris@16
|
560 //! @brief Erases Values from a range <tt>[first, last)</tt>.
|
Chris@16
|
561 //!
|
Chris@16
|
562 //! @param first The position of the first element of a range which will be erased from the container.
|
Chris@16
|
563 //! @param last The position of the one after the last element of a range which will be erased from the container.
|
Chris@16
|
564 //!
|
Chris@16
|
565 //! @par Throws
|
Chris@16
|
566 //! If Value's move assignment throws.
|
Chris@16
|
567 //!
|
Chris@16
|
568 //! @par Complexity
|
Chris@16
|
569 //! Linear O(N).
|
Chris@16
|
570 iterator erase(iterator first, iterator last);
|
Chris@16
|
571
|
Chris@16
|
572 //! @pre <tt>distance(first, last) <= capacity()</tt>
|
Chris@16
|
573 //!
|
Chris@16
|
574 //! @brief Assigns a range <tt>[first, last)</tt> of Values to this container.
|
Chris@16
|
575 //!
|
Chris@16
|
576 //! @param first The iterator to the first element of a range used to construct new content of this container.
|
Chris@16
|
577 //! @param last The iterator to the one after the last element of a range used to construct new content of this container.
|
Chris@16
|
578 //!
|
Chris@16
|
579 //! @par Throws
|
Chris@16
|
580 //! If Value's copy constructor or copy assignment throws,
|
Chris@16
|
581 //!
|
Chris@16
|
582 //! @par Complexity
|
Chris@16
|
583 //! Linear O(N).
|
Chris@16
|
584 template <typename Iterator>
|
Chris@16
|
585 void assign(Iterator first, Iterator last);
|
Chris@16
|
586
|
Chris@16
|
587 //! @pre <tt>count <= capacity()</tt>
|
Chris@16
|
588 //!
|
Chris@16
|
589 //! @brief Assigns a count copies of value to this container.
|
Chris@16
|
590 //!
|
Chris@16
|
591 //! @param count The new number of elements which will be container in the container.
|
Chris@16
|
592 //! @param value The value which will be used to copy construct the new content.
|
Chris@16
|
593 //!
|
Chris@16
|
594 //! @par Throws
|
Chris@16
|
595 //! If Value's copy constructor or copy assignment throws.
|
Chris@16
|
596 //!
|
Chris@16
|
597 //! @par Complexity
|
Chris@16
|
598 //! Linear O(N).
|
Chris@16
|
599 void assign(size_type count, value_type const& value);
|
Chris@16
|
600
|
Chris@16
|
601 //! @pre <tt>size() < capacity()</tt>
|
Chris@16
|
602 //!
|
Chris@16
|
603 //! @brief Inserts a Value constructed with
|
Chris@16
|
604 //! \c std::forward<Args>(args)... in the end of the container.
|
Chris@16
|
605 //!
|
Chris@16
|
606 //! @param args The arguments of the constructor of the new element which will be created at the end of the container.
|
Chris@16
|
607 //!
|
Chris@16
|
608 //! @par Throws
|
Chris@16
|
609 //! If in-place constructor throws or Value's move constructor throws.
|
Chris@16
|
610 //!
|
Chris@16
|
611 //! @par Complexity
|
Chris@16
|
612 //! Constant O(1).
|
Chris@16
|
613 template<class ...Args>
|
Chris@16
|
614 void emplace_back(Args &&...args);
|
Chris@16
|
615
|
Chris@16
|
616 //! @pre
|
Chris@16
|
617 //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>
|
Chris@16
|
618 //! @li <tt>size() < capacity()</tt>
|
Chris@16
|
619 //!
|
Chris@16
|
620 //! @brief Inserts a Value constructed with
|
Chris@16
|
621 //! \c std::forward<Args>(args)... before position
|
Chris@16
|
622 //!
|
Chris@16
|
623 //! @param position The position at which new elements will be inserted.
|
Chris@16
|
624 //! @param args The arguments of the constructor of the new element.
|
Chris@16
|
625 //!
|
Chris@16
|
626 //! @par Throws
|
Chris@16
|
627 //! If in-place constructor throws or if Value's move constructor or move assignment throws.
|
Chris@16
|
628 //!
|
Chris@16
|
629 //! @par Complexity
|
Chris@16
|
630 //! Constant or linear.
|
Chris@16
|
631 template<class ...Args>
|
Chris@16
|
632 iterator emplace(iterator position, Args &&...args);
|
Chris@16
|
633
|
Chris@16
|
634 //! @brief Removes all elements from the container.
|
Chris@16
|
635 //!
|
Chris@16
|
636 //! @par Throws
|
Chris@16
|
637 //! Nothing.
|
Chris@16
|
638 //!
|
Chris@16
|
639 //! @par Complexity
|
Chris@16
|
640 //! Constant O(1).
|
Chris@16
|
641 void clear() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
642
|
Chris@16
|
643 //! @pre <tt>i < size()</tt>
|
Chris@16
|
644 //!
|
Chris@16
|
645 //! @brief Returns reference to the i-th element.
|
Chris@16
|
646 //!
|
Chris@16
|
647 //! @param i The element's index.
|
Chris@16
|
648 //!
|
Chris@16
|
649 //! @return reference to the i-th element
|
Chris@16
|
650 //! from the beginning of the container.
|
Chris@16
|
651 //!
|
Chris@16
|
652 //! @par Throws
|
Chris@16
|
653 //! \c std::out_of_range exception by default.
|
Chris@16
|
654 //!
|
Chris@16
|
655 //! @par Complexity
|
Chris@16
|
656 //! Constant O(1).
|
Chris@16
|
657 reference at(size_type i);
|
Chris@16
|
658
|
Chris@16
|
659 //! @pre <tt>i < size()</tt>
|
Chris@16
|
660 //!
|
Chris@16
|
661 //! @brief Returns const reference to the i-th element.
|
Chris@16
|
662 //!
|
Chris@16
|
663 //! @param i The element's index.
|
Chris@16
|
664 //!
|
Chris@16
|
665 //! @return const reference to the i-th element
|
Chris@16
|
666 //! from the beginning of the container.
|
Chris@16
|
667 //!
|
Chris@16
|
668 //! @par Throws
|
Chris@16
|
669 //! \c std::out_of_range exception by default.
|
Chris@16
|
670 //!
|
Chris@16
|
671 //! @par Complexity
|
Chris@16
|
672 //! Constant O(1).
|
Chris@16
|
673 const_reference at(size_type i) const;
|
Chris@16
|
674
|
Chris@16
|
675 //! @pre <tt>i < size()</tt>
|
Chris@16
|
676 //!
|
Chris@16
|
677 //! @brief Returns reference to the i-th element.
|
Chris@16
|
678 //!
|
Chris@16
|
679 //! @param i The element's index.
|
Chris@16
|
680 //!
|
Chris@16
|
681 //! @return reference to the i-th element
|
Chris@16
|
682 //! from the beginning of the container.
|
Chris@16
|
683 //!
|
Chris@16
|
684 //! @par Throws
|
Chris@16
|
685 //! Nothing by default.
|
Chris@16
|
686 //!
|
Chris@16
|
687 //! @par Complexity
|
Chris@16
|
688 //! Constant O(1).
|
Chris@16
|
689 reference operator[](size_type i);
|
Chris@16
|
690
|
Chris@16
|
691 //! @pre <tt>i < size()</tt>
|
Chris@16
|
692 //!
|
Chris@16
|
693 //! @brief Returns const reference to the i-th element.
|
Chris@16
|
694 //!
|
Chris@16
|
695 //! @param i The element's index.
|
Chris@16
|
696 //!
|
Chris@16
|
697 //! @return const reference to the i-th element
|
Chris@16
|
698 //! from the beginning of the container.
|
Chris@16
|
699 //!
|
Chris@16
|
700 //! @par Throws
|
Chris@16
|
701 //! Nothing by default.
|
Chris@16
|
702 //!
|
Chris@16
|
703 //! @par Complexity
|
Chris@16
|
704 //! Constant O(1).
|
Chris@16
|
705 const_reference operator[](size_type i) const;
|
Chris@16
|
706
|
Chris@16
|
707 //! @pre \c !empty()
|
Chris@16
|
708 //!
|
Chris@16
|
709 //! @brief Returns reference to the first element.
|
Chris@16
|
710 //!
|
Chris@16
|
711 //! @return reference to the first element
|
Chris@16
|
712 //! from the beginning of the container.
|
Chris@16
|
713 //!
|
Chris@16
|
714 //! @par Throws
|
Chris@16
|
715 //! Nothing by default.
|
Chris@16
|
716 //!
|
Chris@16
|
717 //! @par Complexity
|
Chris@16
|
718 //! Constant O(1).
|
Chris@16
|
719 reference front();
|
Chris@16
|
720
|
Chris@16
|
721 //! @pre \c !empty()
|
Chris@16
|
722 //!
|
Chris@16
|
723 //! @brief Returns const reference to the first element.
|
Chris@16
|
724 //!
|
Chris@16
|
725 //! @return const reference to the first element
|
Chris@16
|
726 //! from the beginning of the container.
|
Chris@16
|
727 //!
|
Chris@16
|
728 //! @par Throws
|
Chris@16
|
729 //! Nothing by default.
|
Chris@16
|
730 //!
|
Chris@16
|
731 //! @par Complexity
|
Chris@16
|
732 //! Constant O(1).
|
Chris@16
|
733 const_reference front() const;
|
Chris@16
|
734
|
Chris@16
|
735 //! @pre \c !empty()
|
Chris@16
|
736 //!
|
Chris@16
|
737 //! @brief Returns reference to the last element.
|
Chris@16
|
738 //!
|
Chris@16
|
739 //! @return reference to the last element
|
Chris@16
|
740 //! from the beginning of the container.
|
Chris@16
|
741 //!
|
Chris@16
|
742 //! @par Throws
|
Chris@16
|
743 //! Nothing by default.
|
Chris@16
|
744 //!
|
Chris@16
|
745 //! @par Complexity
|
Chris@16
|
746 //! Constant O(1).
|
Chris@16
|
747 reference back();
|
Chris@16
|
748
|
Chris@16
|
749 //! @pre \c !empty()
|
Chris@16
|
750 //!
|
Chris@16
|
751 //! @brief Returns const reference to the first element.
|
Chris@16
|
752 //!
|
Chris@16
|
753 //! @return const reference to the last element
|
Chris@16
|
754 //! from the beginning of the container.
|
Chris@16
|
755 //!
|
Chris@16
|
756 //! @par Throws
|
Chris@16
|
757 //! Nothing by default.
|
Chris@16
|
758 //!
|
Chris@16
|
759 //! @par Complexity
|
Chris@16
|
760 //! Constant O(1).
|
Chris@16
|
761 const_reference back() const;
|
Chris@16
|
762
|
Chris@16
|
763 //! @brief Pointer such that <tt>[data(), data() + size())</tt> is a valid range.
|
Chris@16
|
764 //! For a non-empty vector <tt>data() == &front()</tt>.
|
Chris@16
|
765 //!
|
Chris@16
|
766 //! @par Throws
|
Chris@16
|
767 //! Nothing.
|
Chris@16
|
768 //!
|
Chris@16
|
769 //! @par Complexity
|
Chris@16
|
770 //! Constant O(1).
|
Chris@16
|
771 Value * data() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
772
|
Chris@16
|
773 //! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range.
|
Chris@16
|
774 //! For a non-empty vector <tt>data() == &front()</tt>.
|
Chris@16
|
775 //!
|
Chris@16
|
776 //! @par Throws
|
Chris@16
|
777 //! Nothing.
|
Chris@16
|
778 //!
|
Chris@16
|
779 //! @par Complexity
|
Chris@16
|
780 //! Constant O(1).
|
Chris@16
|
781 const Value * data() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
782
|
Chris@16
|
783 //! @brief Returns iterator to the first element.
|
Chris@16
|
784 //!
|
Chris@16
|
785 //! @return iterator to the first element contained in the vector.
|
Chris@16
|
786 //!
|
Chris@16
|
787 //! @par Throws
|
Chris@16
|
788 //! Nothing.
|
Chris@16
|
789 //!
|
Chris@16
|
790 //! @par Complexity
|
Chris@16
|
791 //! Constant O(1).
|
Chris@16
|
792 iterator begin() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
793
|
Chris@16
|
794 //! @brief Returns const iterator to the first element.
|
Chris@16
|
795 //!
|
Chris@16
|
796 //! @return const_iterator to the first element contained in the vector.
|
Chris@16
|
797 //!
|
Chris@16
|
798 //! @par Throws
|
Chris@16
|
799 //! Nothing.
|
Chris@16
|
800 //!
|
Chris@16
|
801 //! @par Complexity
|
Chris@16
|
802 //! Constant O(1).
|
Chris@16
|
803 const_iterator begin() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
804
|
Chris@16
|
805 //! @brief Returns const iterator to the first element.
|
Chris@16
|
806 //!
|
Chris@16
|
807 //! @return const_iterator to the first element contained in the vector.
|
Chris@16
|
808 //!
|
Chris@16
|
809 //! @par Throws
|
Chris@16
|
810 //! Nothing.
|
Chris@16
|
811 //!
|
Chris@16
|
812 //! @par Complexity
|
Chris@16
|
813 //! Constant O(1).
|
Chris@16
|
814 const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
815
|
Chris@16
|
816 //! @brief Returns iterator to the one after the last element.
|
Chris@16
|
817 //!
|
Chris@16
|
818 //! @return iterator pointing to the one after the last element contained in the vector.
|
Chris@16
|
819 //!
|
Chris@16
|
820 //! @par Throws
|
Chris@16
|
821 //! Nothing.
|
Chris@16
|
822 //!
|
Chris@16
|
823 //! @par Complexity
|
Chris@16
|
824 //! Constant O(1).
|
Chris@16
|
825 iterator end() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
826
|
Chris@16
|
827 //! @brief Returns const iterator to the one after the last element.
|
Chris@16
|
828 //!
|
Chris@16
|
829 //! @return const_iterator pointing to the one after the last element contained in the vector.
|
Chris@16
|
830 //!
|
Chris@16
|
831 //! @par Throws
|
Chris@16
|
832 //! Nothing.
|
Chris@16
|
833 //!
|
Chris@16
|
834 //! @par Complexity
|
Chris@16
|
835 //! Constant O(1).
|
Chris@16
|
836 const_iterator end() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
837
|
Chris@16
|
838 //! @brief Returns const iterator to the one after the last element.
|
Chris@16
|
839 //!
|
Chris@16
|
840 //! @return const_iterator pointing to the one after the last element contained in the vector.
|
Chris@16
|
841 //!
|
Chris@16
|
842 //! @par Throws
|
Chris@16
|
843 //! Nothing.
|
Chris@16
|
844 //!
|
Chris@16
|
845 //! @par Complexity
|
Chris@16
|
846 //! Constant O(1).
|
Chris@16
|
847 const_iterator cend() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
848
|
Chris@16
|
849 //! @brief Returns reverse iterator to the first element of the reversed container.
|
Chris@16
|
850 //!
|
Chris@16
|
851 //! @return reverse_iterator pointing to the beginning
|
Chris@16
|
852 //! of the reversed static_vector.
|
Chris@16
|
853 //!
|
Chris@16
|
854 //! @par Throws
|
Chris@16
|
855 //! Nothing.
|
Chris@16
|
856 //!
|
Chris@16
|
857 //! @par Complexity
|
Chris@16
|
858 //! Constant O(1).
|
Chris@16
|
859 reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
860
|
Chris@16
|
861 //! @brief Returns const reverse iterator to the first element of the reversed container.
|
Chris@16
|
862 //!
|
Chris@16
|
863 //! @return const_reverse_iterator pointing to the beginning
|
Chris@16
|
864 //! of the reversed static_vector.
|
Chris@16
|
865 //!
|
Chris@16
|
866 //! @par Throws
|
Chris@16
|
867 //! Nothing.
|
Chris@16
|
868 //!
|
Chris@16
|
869 //! @par Complexity
|
Chris@16
|
870 //! Constant O(1).
|
Chris@16
|
871 const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
872
|
Chris@16
|
873 //! @brief Returns const reverse iterator to the first element of the reversed container.
|
Chris@16
|
874 //!
|
Chris@16
|
875 //! @return const_reverse_iterator pointing to the beginning
|
Chris@16
|
876 //! of the reversed static_vector.
|
Chris@16
|
877 //!
|
Chris@16
|
878 //! @par Throws
|
Chris@16
|
879 //! Nothing.
|
Chris@16
|
880 //!
|
Chris@16
|
881 //! @par Complexity
|
Chris@16
|
882 //! Constant O(1).
|
Chris@16
|
883 const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
884
|
Chris@16
|
885 //! @brief Returns reverse iterator to the one after the last element of the reversed container.
|
Chris@16
|
886 //!
|
Chris@16
|
887 //! @return reverse_iterator pointing to the one after the last element
|
Chris@16
|
888 //! of the reversed static_vector.
|
Chris@16
|
889 //!
|
Chris@16
|
890 //! @par Throws
|
Chris@16
|
891 //! Nothing.
|
Chris@16
|
892 //!
|
Chris@16
|
893 //! @par Complexity
|
Chris@16
|
894 //! Constant O(1).
|
Chris@16
|
895 reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
896
|
Chris@16
|
897 //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
|
Chris@16
|
898 //!
|
Chris@16
|
899 //! @return const_reverse_iterator pointing to the one after the last element
|
Chris@16
|
900 //! of the reversed static_vector.
|
Chris@16
|
901 //!
|
Chris@16
|
902 //! @par Throws
|
Chris@16
|
903 //! Nothing.
|
Chris@16
|
904 //!
|
Chris@16
|
905 //! @par Complexity
|
Chris@16
|
906 //! Constant O(1).
|
Chris@16
|
907 const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
908
|
Chris@16
|
909 //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
|
Chris@16
|
910 //!
|
Chris@16
|
911 //! @return const_reverse_iterator pointing to the one after the last element
|
Chris@16
|
912 //! of the reversed static_vector.
|
Chris@16
|
913 //!
|
Chris@16
|
914 //! @par Throws
|
Chris@16
|
915 //! Nothing.
|
Chris@16
|
916 //!
|
Chris@16
|
917 //! @par Complexity
|
Chris@16
|
918 //! Constant O(1).
|
Chris@16
|
919 const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
920
|
Chris@16
|
921 //! @brief Returns container's capacity.
|
Chris@16
|
922 //!
|
Chris@16
|
923 //! @return container's capacity.
|
Chris@16
|
924 //!
|
Chris@16
|
925 //! @par Throws
|
Chris@16
|
926 //! Nothing.
|
Chris@16
|
927 //!
|
Chris@16
|
928 //! @par Complexity
|
Chris@16
|
929 //! Constant O(1).
|
Chris@16
|
930 static size_type capacity() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
931
|
Chris@16
|
932 //! @brief Returns container's capacity.
|
Chris@16
|
933 //!
|
Chris@16
|
934 //! @return container's capacity.
|
Chris@16
|
935 //!
|
Chris@16
|
936 //! @par Throws
|
Chris@16
|
937 //! Nothing.
|
Chris@16
|
938 //!
|
Chris@16
|
939 //! @par Complexity
|
Chris@16
|
940 //! Constant O(1).
|
Chris@16
|
941 static size_type max_size() BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
942
|
Chris@16
|
943 //! @brief Returns the number of stored elements.
|
Chris@16
|
944 //!
|
Chris@16
|
945 //! @return Number of elements contained in the container.
|
Chris@16
|
946 //!
|
Chris@16
|
947 //! @par Throws
|
Chris@16
|
948 //! Nothing.
|
Chris@16
|
949 //!
|
Chris@16
|
950 //! @par Complexity
|
Chris@16
|
951 //! Constant O(1).
|
Chris@16
|
952 size_type size() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
953
|
Chris@16
|
954 //! @brief Queries if the container contains elements.
|
Chris@16
|
955 //!
|
Chris@16
|
956 //! @return true if the number of elements contained in the
|
Chris@16
|
957 //! container is equal to 0.
|
Chris@16
|
958 //!
|
Chris@16
|
959 //! @par Throws
|
Chris@16
|
960 //! Nothing.
|
Chris@16
|
961 //!
|
Chris@16
|
962 //! @par Complexity
|
Chris@16
|
963 //! Constant O(1).
|
Chris@16
|
964 bool empty() const BOOST_CONTAINER_NOEXCEPT;
|
Chris@16
|
965 #else
|
Chris@16
|
966
|
Chris@16
|
967 friend void swap(static_vector &x, static_vector &y)
|
Chris@16
|
968 {
|
Chris@16
|
969 x.swap(y);
|
Chris@16
|
970 }
|
Chris@16
|
971
|
Chris@16
|
972 #endif // BOOST_CONTAINER_DOXYGEN_INVOKED
|
Chris@16
|
973
|
Chris@16
|
974 };
|
Chris@16
|
975
|
Chris@16
|
976 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
|
Chris@16
|
977
|
Chris@16
|
978 //! @brief Checks if contents of two static_vectors are equal.
|
Chris@16
|
979 //!
|
Chris@16
|
980 //! @ingroup static_vector_non_member
|
Chris@16
|
981 //!
|
Chris@16
|
982 //! @param x The first static_vector.
|
Chris@16
|
983 //! @param y The second static_vector.
|
Chris@16
|
984 //!
|
Chris@16
|
985 //! @return \c true if containers have the same size and elements in both containers are equal.
|
Chris@16
|
986 //!
|
Chris@16
|
987 //! @par Complexity
|
Chris@16
|
988 //! Linear O(N).
|
Chris@16
|
989 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
990 bool operator== (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
|
Chris@16
|
991
|
Chris@16
|
992 //! @brief Checks if contents of two static_vectors are not equal.
|
Chris@16
|
993 //!
|
Chris@16
|
994 //! @ingroup static_vector_non_member
|
Chris@16
|
995 //!
|
Chris@16
|
996 //! @param x The first static_vector.
|
Chris@16
|
997 //! @param y The second static_vector.
|
Chris@16
|
998 //!
|
Chris@16
|
999 //! @return \c true if containers have different size or elements in both containers are not equal.
|
Chris@16
|
1000 //!
|
Chris@16
|
1001 //! @par Complexity
|
Chris@16
|
1002 //! Linear O(N).
|
Chris@16
|
1003 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1004 bool operator!= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
|
Chris@16
|
1005
|
Chris@16
|
1006 //! @brief Lexicographically compares static_vectors.
|
Chris@16
|
1007 //!
|
Chris@16
|
1008 //! @ingroup static_vector_non_member
|
Chris@16
|
1009 //!
|
Chris@16
|
1010 //! @param x The first static_vector.
|
Chris@16
|
1011 //! @param y The second static_vector.
|
Chris@16
|
1012 //!
|
Chris@16
|
1013 //! @return \c true if x compares lexicographically less than y.
|
Chris@16
|
1014 //!
|
Chris@16
|
1015 //! @par Complexity
|
Chris@16
|
1016 //! Linear O(N).
|
Chris@16
|
1017 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1018 bool operator< (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
|
Chris@16
|
1019
|
Chris@16
|
1020 //! @brief Lexicographically compares static_vectors.
|
Chris@16
|
1021 //!
|
Chris@16
|
1022 //! @ingroup static_vector_non_member
|
Chris@16
|
1023 //!
|
Chris@16
|
1024 //! @param x The first static_vector.
|
Chris@16
|
1025 //! @param y The second static_vector.
|
Chris@16
|
1026 //!
|
Chris@16
|
1027 //! @return \c true if y compares lexicographically less than x.
|
Chris@16
|
1028 //!
|
Chris@16
|
1029 //! @par Complexity
|
Chris@16
|
1030 //! Linear O(N).
|
Chris@16
|
1031 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1032 bool operator> (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
|
Chris@16
|
1033
|
Chris@16
|
1034 //! @brief Lexicographically compares static_vectors.
|
Chris@16
|
1035 //!
|
Chris@16
|
1036 //! @ingroup static_vector_non_member
|
Chris@16
|
1037 //!
|
Chris@16
|
1038 //! @param x The first static_vector.
|
Chris@16
|
1039 //! @param y The second static_vector.
|
Chris@16
|
1040 //!
|
Chris@16
|
1041 //! @return \c true if y don't compare lexicographically less than x.
|
Chris@16
|
1042 //!
|
Chris@16
|
1043 //! @par Complexity
|
Chris@16
|
1044 //! Linear O(N).
|
Chris@16
|
1045 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1046 bool operator<= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
|
Chris@16
|
1047
|
Chris@16
|
1048 //! @brief Lexicographically compares static_vectors.
|
Chris@16
|
1049 //!
|
Chris@16
|
1050 //! @ingroup static_vector_non_member
|
Chris@16
|
1051 //!
|
Chris@16
|
1052 //! @param x The first static_vector.
|
Chris@16
|
1053 //! @param y The second static_vector.
|
Chris@16
|
1054 //!
|
Chris@16
|
1055 //! @return \c true if x don't compare lexicographically less than y.
|
Chris@16
|
1056 //!
|
Chris@16
|
1057 //! @par Complexity
|
Chris@16
|
1058 //! Linear O(N).
|
Chris@16
|
1059 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1060 bool operator>= (static_vector<V, C1> const& x, static_vector<V, C2> const& y);
|
Chris@16
|
1061
|
Chris@16
|
1062 //! @brief Swaps contents of two static_vectors.
|
Chris@16
|
1063 //!
|
Chris@16
|
1064 //! This function calls static_vector::swap().
|
Chris@16
|
1065 //!
|
Chris@16
|
1066 //! @ingroup static_vector_non_member
|
Chris@16
|
1067 //!
|
Chris@16
|
1068 //! @param x The first static_vector.
|
Chris@16
|
1069 //! @param y The second static_vector.
|
Chris@16
|
1070 //!
|
Chris@16
|
1071 //! @par Complexity
|
Chris@16
|
1072 //! Linear O(N).
|
Chris@16
|
1073 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1074 inline void swap(static_vector<V, C1> & x, static_vector<V, C2> & y);
|
Chris@16
|
1075
|
Chris@16
|
1076 #else
|
Chris@16
|
1077
|
Chris@16
|
1078 template<typename V, std::size_t C1, std::size_t C2>
|
Chris@16
|
1079 inline void swap(static_vector<V, C1> & x, static_vector<V, C2> & y
|
Chris@16
|
1080 , typename container_detail::enable_if_c< C1 != C2>::type * = 0)
|
Chris@16
|
1081 {
|
Chris@16
|
1082 x.swap(y);
|
Chris@16
|
1083 }
|
Chris@16
|
1084
|
Chris@16
|
1085 #endif // BOOST_CONTAINER_DOXYGEN_INVOKED
|
Chris@16
|
1086
|
Chris@16
|
1087 }} // namespace boost::container
|
Chris@16
|
1088
|
Chris@16
|
1089 #include <boost/container/detail/config_end.hpp>
|
Chris@16
|
1090
|
Chris@16
|
1091 #endif // BOOST_CONTAINER_STATIC_VECTOR_HPP
|