|
|
|||
File indexing completed on 2025-12-15 09:45:33
0001 // Boost.Container static_vector 0002 // 0003 // Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland. 0004 // Copyright (c) 2011-2013 Andrew Hundt. 0005 // Copyright (c) 2013-2014 Ion Gaztanaga 0006 // 0007 // Use, modification and distribution is subject to the Boost Software License, 0008 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0009 // http://www.boost.org/LICENSE_1_0.txt) 0010 0011 #ifndef BOOST_CONTAINER_STATIC_VECTOR_HPP 0012 #define BOOST_CONTAINER_STATIC_VECTOR_HPP 0013 0014 #ifndef BOOST_CONFIG_HPP 0015 # include <boost/config.hpp> 0016 #endif 0017 0018 #if defined(BOOST_HAS_PRAGMA_ONCE) 0019 # pragma once 0020 #endif 0021 0022 #include <boost/container/detail/config_begin.hpp> 0023 #include <boost/container/detail/workaround.hpp> 0024 #include <boost/container/detail/type_traits.hpp> 0025 #include <boost/move/detail/launder.hpp> 0026 #include <boost/container/vector.hpp> 0027 0028 #include <cstddef> 0029 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) 0030 #include <initializer_list> 0031 #endif 0032 0033 namespace boost { namespace container { 0034 0035 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED 0036 0037 namespace dtl { 0038 0039 template<class T, std::size_t N, std::size_t InplaceAlignment, bool ThrowOnOverflow> 0040 class static_storage_allocator 0041 { 0042 typedef bool_<ThrowOnOverflow> throw_on_overflow_t; 0043 0044 static BOOST_NORETURN inline void on_capacity_overflow(true_type) 0045 { 0046 (throw_bad_alloc)(); 0047 } 0048 0049 static inline void on_capacity_overflow(false_type) 0050 { 0051 BOOST_ASSERT_MSG(false, "ERROR: static vector capacity overflow"); 0052 } 0053 0054 public: 0055 typedef T value_type; 0056 0057 inline static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW 0058 {} 0059 0060 inline static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW 0061 {} 0062 0063 inline static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW 0064 { return *this; } 0065 0066 inline T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW 0067 { return move_detail::launder_cast<T*>(&storage); } 0068 0069 BOOST_STATIC_CONSTEXPR std::size_t internal_capacity = N; 0070 0071 std::size_t max_size() const 0072 { return N; } 0073 0074 static inline void on_capacity_overflow() 0075 { 0076 (on_capacity_overflow)(throw_on_overflow_t()); 0077 } 0078 0079 typedef boost::container::dtl::version_type<static_storage_allocator, 0> version; 0080 0081 inline friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW 0082 { return false; } 0083 0084 inline friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW 0085 { return true; } 0086 0087 private: 0088 BOOST_CONTAINER_STATIC_ASSERT_MSG(!InplaceAlignment || (InplaceAlignment & (InplaceAlignment-1)) == 0, "Alignment option must be zero or power of two"); 0089 BOOST_STATIC_CONSTEXPR std::size_t final_alignment = InplaceAlignment ? InplaceAlignment : dtl::alignment_of<T>::value; 0090 typename dtl::aligned_storage<sizeof(T)*N, final_alignment>::type storage; 0091 }; 0092 0093 template<class Options> 0094 struct get_static_vector_opt 0095 { 0096 typedef Options type; 0097 }; 0098 0099 template<> 0100 struct get_static_vector_opt<void> 0101 { 0102 typedef static_vector_null_opt type; 0103 }; 0104 0105 template<class Options> 0106 struct get_vector_opt_from_static_vector_opt 0107 { 0108 typedef typename get_static_vector_opt<Options>::type options_t; 0109 typedef vector_opt<void, typename options_t::stored_size_type> type; 0110 }; 0111 0112 template<> 0113 struct get_vector_opt_from_static_vector_opt<void> 0114 { 0115 typedef void type; 0116 }; 0117 0118 template <typename T, std::size_t Capacity, class Options> 0119 struct get_static_vector_allocator 0120 { 0121 typedef typename get_static_vector_opt<Options>::type options_t; 0122 typedef dtl::static_storage_allocator 0123 < T 0124 , Capacity 0125 , options_t::inplace_alignment 0126 , options_t::throw_on_overflow 0127 > type; 0128 }; 0129 0130 } //namespace dtl { 0131 0132 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED 0133 0134 //! 0135 //!@brief A variable-size array container with fixed capacity. 0136 //! 0137 //!static_vector is a sequence container like boost::container::vector with contiguous storage that can 0138 //!change in size, along with the static allocation, low overhead, and fixed capacity of boost::array. 0139 //! 0140 //!A static_vector is a sequence that supports random access to elements, constant time insertion and 0141 //!removal of elements at the end, and linear time insertion and removal of elements at the beginning or 0142 //!in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity 0143 //!because elements are stored within the object itself similarly to an array. However, objects are 0144 //!initialized as they are inserted into static_vector unlike C arrays or std::array which must construct 0145 //!all elements on instantiation. The behavior of static_vector enables the use of statically allocated 0146 //!elements in cases with complex object lifetime requirements that would otherwise not be trivially 0147 //!possible. 0148 //! 0149 //!@par Error Handling 0150 //! If `throw_on_overflow` option is true (default behaviour), insertion beyond the capacity result 0151 //! in throwing bad_alloc() if exceptions are enabled and or calling throw_bad_alloc() if not enabled. 0152 //! If `throw_on_overflow` option is false, insertion beyond capacity results in Undefined Behaviour. 0153 //! 0154 //! out_of_range is thrown if out of bounds access is performed in <code>at()</code> if exceptions are 0155 //! enabled, throw_out_of_range() if not enabled. 0156 //! 0157 //!@tparam T The type of element that will be stored. 0158 //!@tparam Capacity The maximum number of elements static_vector can store, fixed at compile time. 0159 //!@tparam Options A type produced from \c boost::container::static_vector_options. If no option 0160 //! is specified, by default throw_on_overflow<true> option is set. 0161 template <typename T, std::size_t Capacity, class Options BOOST_CONTAINER_DOCONLY(= void) > 0162 class static_vector 0163 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED 0164 : public vector< T 0165 , typename dtl::get_static_vector_allocator< T, Capacity, Options>::type 0166 , typename dtl::get_vector_opt_from_static_vector_opt<Options>::type 0167 > 0168 #endif 0169 { 0170 public: 0171 #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED 0172 typedef typename dtl::get_static_vector_allocator< T, Capacity, Options>::type allocator_type; 0173 typedef typename dtl::get_vector_opt_from_static_vector_opt<Options>::type options_type; 0174 typedef vector<T, allocator_type, options_type> base_t; 0175 0176 BOOST_COPYABLE_AND_MOVABLE(static_vector) 0177 0178 template<class U, std::size_t OtherCapacity, class OtherOptions> 0179 friend class static_vector; 0180 0181 public: 0182 #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED 0183 0184 public: 0185 //! @brief The type of elements stored in the container. 0186 typedef typename base_t::value_type value_type; 0187 //! @brief The unsigned integral type used by the container. 0188 typedef typename base_t::size_type size_type; 0189 //! @brief The pointers difference type. 0190 typedef typename base_t::difference_type difference_type; 0191 //! @brief The pointer type. 0192 typedef typename base_t::pointer pointer; 0193 //! @brief The const pointer type. 0194 typedef typename base_t::const_pointer const_pointer; 0195 //! @brief The value reference type. 0196 typedef typename base_t::reference reference; 0197 //! @brief The value const reference type. 0198 typedef typename base_t::const_reference const_reference; 0199 //! @brief The iterator type. 0200 typedef typename base_t::iterator iterator; 0201 //! @brief The const iterator type. 0202 typedef typename base_t::const_iterator const_iterator; 0203 //! @brief The reverse iterator type. 0204 typedef typename base_t::reverse_iterator reverse_iterator; 0205 //! @brief The const reverse iterator. 0206 typedef typename base_t::const_reverse_iterator const_reverse_iterator; 0207 0208 //! @brief The capacity/max size of the container 0209 BOOST_STATIC_CONSTEXPR size_type static_capacity = Capacity; 0210 0211 //! @brief Constructs an empty static_vector. 0212 //! 0213 //! @par Throws 0214 //! Nothing. 0215 //! 0216 //! @par Complexity 0217 //! Constant O(1). 0218 inline static_vector() BOOST_NOEXCEPT_OR_NOTHROW 0219 : base_t() 0220 {} 0221 0222 //! @pre <tt>count <= capacity()</tt> 0223 //! 0224 //! @brief Constructs a static_vector containing count value initialized values. 0225 //! 0226 //! @param count The number of values which will be contained in the container. 0227 //! 0228 //! @par Throws 0229 //! @li If T's value initialization throws 0230 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0231 //! 0232 //! @par Complexity 0233 //! Linear O(N). 0234 inline explicit static_vector(size_type count) 0235 : base_t(count) 0236 {} 0237 0238 //! @pre <tt>count <= capacity()</tt> 0239 //! 0240 //! @brief Constructs a static_vector containing count default initialized values. 0241 //! 0242 //! @param count The number of values which will be contained in the container. 0243 //! 0244 //! @par Throws 0245 //! @li If T's default initialization throws. 0246 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0247 //! 0248 //! @par Complexity 0249 //! Linear O(N). 0250 //! 0251 //! @par Note 0252 //! Non-standard extension 0253 inline static_vector(size_type count, default_init_t) 0254 : base_t(count, default_init_t()) 0255 {} 0256 0257 //! @pre <tt>count <= capacity()</tt> 0258 //! 0259 //! @brief Constructs a static_vector containing count copies of value. 0260 //! 0261 //! @param count The number of copies of a values that will be contained in the container. 0262 //! @param value The value which will be used to copy construct values. 0263 //! 0264 //! @par Throws 0265 //! @li If T's copy constructor throws. 0266 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0267 //! 0268 //! @par Complexity 0269 //! Linear O(N). 0270 inline static_vector(size_type count, value_type const& value) 0271 : base_t(count, value) 0272 {} 0273 0274 //! @pre 0275 //! @li <tt>distance(first, last) <= capacity()</tt> 0276 //! @li Iterator must meet the \c ForwardTraversalIterator concept. 0277 //! 0278 //! @brief Constructs a static_vector containing copy of a range <tt>[first, last)</tt>. 0279 //! 0280 //! @param first The iterator to the first element in range. 0281 //! @param last The iterator to the one after the last element in range. 0282 //! 0283 //! @par Throws 0284 //! @li If T's constructor taking a dereferenced Iterator throws. 0285 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0286 //! 0287 //! @par Complexity 0288 //! Linear O(N). 0289 template <typename Iterator> 0290 inline static_vector(Iterator first, Iterator last) 0291 : base_t(first, last) 0292 {} 0293 0294 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) 0295 //! @pre 0296 //! @li <tt>distance(il.begin(), il.end()) <= capacity()</tt> 0297 //! 0298 //! @brief Constructs a static_vector containing copy of a range <tt>[il.begin(), il.end())</tt>. 0299 //! 0300 //! @param il std::initializer_list with values to initialize vector. 0301 //! 0302 //! @par Throws 0303 //! @li If T's constructor taking a dereferenced std::initializer_list throws. 0304 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0305 //! 0306 //! @par Complexity 0307 //! Linear O(N). 0308 inline static_vector(std::initializer_list<value_type> il) 0309 : base_t(il) 0310 {} 0311 #endif 0312 0313 //! @brief Constructs a copy of other static_vector. 0314 //! 0315 //! @param other The static_vector which content will be copied to this one. 0316 //! 0317 //! @par Throws 0318 //! If T's copy constructor throws. 0319 //! 0320 //! @par Complexity 0321 //! Linear O(N). 0322 inline static_vector(static_vector const& other) 0323 : base_t(other) 0324 {} 0325 0326 inline static_vector(static_vector const& other, const allocator_type &) 0327 : base_t(other) 0328 {} 0329 0330 inline static_vector(BOOST_RV_REF(static_vector) other, const allocator_type &) 0331 BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<value_type>::value) 0332 : base_t(BOOST_MOVE_BASE(base_t, other)) 0333 {} 0334 0335 inline explicit static_vector(const allocator_type &) 0336 : base_t() 0337 {} 0338 0339 //! @pre <tt>other.size() <= capacity()</tt>. 0340 //! 0341 //! @brief Constructs a copy of other static_vector. 0342 //! 0343 //! @param other The static_vector which content will be copied to this one. 0344 //! 0345 //! @par Throws 0346 //! @li If T's copy constructor throws. 0347 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0348 //! 0349 //! @par Complexity 0350 //! Linear O(N). 0351 template <std::size_t C, class O> 0352 inline static_vector(static_vector<T, C, O> const& other) 0353 : base_t(other) 0354 {} 0355 0356 //! @brief Move constructor. Moves Values stored in the other static_vector to this one. 0357 //! 0358 //! @param other The static_vector which content will be moved to this one. 0359 //! 0360 //! @par Throws 0361 //! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor throws. 0362 //! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor throws. 0363 //! 0364 //! @par Complexity 0365 //! Linear O(N). 0366 inline static_vector(BOOST_RV_REF(static_vector) other) 0367 BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<value_type>::value) 0368 : base_t(BOOST_MOVE_BASE(base_t, other)) 0369 {} 0370 0371 //! @pre <tt>other.size() <= capacity()</tt> 0372 //! 0373 //! @brief Move constructor. Moves Values stored in the other static_vector to this one. 0374 //! 0375 //! @param other The static_vector which content will be moved to this one. 0376 //! 0377 //! @par Throws 0378 //! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor throws. 0379 //! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor throws. 0380 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0381 //! 0382 //! @par Complexity 0383 //! Linear O(N). 0384 template <std::size_t C, class O> 0385 inline static_vector(BOOST_RV_REF_BEG static_vector<T, C, O> BOOST_RV_REF_END other) 0386 : base_t(BOOST_MOVE_BASE(typename static_vector<T BOOST_MOVE_I C>::base_t, other)) 0387 {} 0388 0389 //! @brief Copy assigns Values stored in the other static_vector to this one. 0390 //! 0391 //! @param other The static_vector which content will be copied to this one. 0392 //! 0393 //! @par Throws 0394 //! If T's copy constructor or copy assignment throws. 0395 //! 0396 //! @par Complexity 0397 //! Linear O(N). 0398 inline static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other) 0399 { 0400 return static_cast<static_vector&>(base_t::operator=(static_cast<base_t const&>(other))); 0401 } 0402 0403 #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) 0404 //! @brief Copy assigns Values stored in std::initializer_list to *this. 0405 //! 0406 //! @param il The std::initializer_list which content will be copied to this one. 0407 //! 0408 //! @par Throws 0409 //! @li If T's copy constructor or copy assignment throws. 0410 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0411 //! 0412 //! @par Complexity 0413 //! Linear O(N). 0414 inline static_vector & operator=(std::initializer_list<value_type> il) 0415 { return static_cast<static_vector&>(base_t::operator=(il)); } 0416 #endif 0417 0418 //! @pre <tt>other.size() <= capacity()</tt> 0419 //! 0420 //! @brief Copy assigns Values stored in the other static_vector to this one. 0421 //! 0422 //! @param other The static_vector which content will be copied to this one. 0423 //! 0424 //! @par Throws 0425 //! @li If T's copy constructor or copy assignment throws. 0426 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0427 //! 0428 //! @par Complexity 0429 //! Linear O(N). 0430 template <std::size_t C, class O> 0431 inline static_vector & operator=(static_vector<T, C, O> const& other) 0432 { 0433 return static_cast<static_vector&>(base_t::operator= 0434 (static_cast<typename static_vector<T, C, O>::base_t const&>(other))); 0435 } 0436 0437 //! @brief Move assignment. Moves Values stored in the other static_vector to this one. 0438 //! 0439 //! @param other The static_vector which content will be moved to this one. 0440 //! 0441 //! @par Throws 0442 //! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws. 0443 //! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws. 0444 //! 0445 //! @par Complexity 0446 //! Linear O(N). 0447 inline static_vector & operator=(BOOST_RV_REF(static_vector) other) 0448 BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_assignable<value_type>::value) 0449 { 0450 return static_cast<static_vector&>(base_t::operator=(BOOST_MOVE_BASE(base_t, other))); 0451 } 0452 0453 //! @pre <tt>other.size() <= capacity()</tt> 0454 //! 0455 //! @brief Move assignment. Moves Values stored in the other static_vector to this one. 0456 //! 0457 //! @param other The static_vector which content will be moved to this one. 0458 //! 0459 //! @par Throws 0460 //! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws. 0461 //! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws. 0462 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0463 //! 0464 //! @par Complexity 0465 //! Linear O(N). 0466 template <std::size_t C, class O> 0467 inline static_vector & operator=(BOOST_RV_REF_BEG static_vector<T, C, O> BOOST_RV_REF_END other) 0468 { 0469 return static_cast<static_vector&>(base_t::operator= 0470 (BOOST_MOVE_BASE(typename static_vector<T BOOST_MOVE_I C>::base_t, other))); 0471 } 0472 0473 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED 0474 0475 //! @brief Destructor. Destroys Values stored in this container. 0476 //! 0477 //! @par Throws 0478 //! Nothing 0479 //! 0480 //! @par Complexity 0481 //! Linear O(N). 0482 ~static_vector(); 0483 0484 //! @brief Swaps contents of the other static_vector and this one. 0485 //! 0486 //! @param other The static_vector which content will be swapped with this one's content. 0487 //! 0488 //! @par Throws 0489 //! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws, 0490 //! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws, 0491 //! 0492 //! @par Complexity 0493 //! Linear O(N). 0494 void swap(static_vector & other); 0495 0496 //! @pre <tt>other.size() <= capacity() && size() <= other.capacity()</tt> 0497 //! 0498 //! @brief Swaps contents of the other static_vector and this one. 0499 //! 0500 //! @param other The static_vector which content will be swapped with this one's content. 0501 //! 0502 //! @par Throws 0503 //! @li If \c has_nothrow_move<T>::value is \c true and T's move constructor or move assignment throws, 0504 //! @li If \c has_nothrow_move<T>::value is \c false and T's copy constructor or copy assignment throws, 0505 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0506 //! 0507 //! @par Complexity 0508 //! Linear O(N). 0509 template <std::size_t C, class O> 0510 void swap(static_vector<T, C, O> & other); 0511 0512 //! @pre <tt>count <= capacity()</tt> 0513 //! 0514 //! @brief Inserts or erases elements at the end such that 0515 //! the size becomes count. New elements are value initialized. 0516 //! 0517 //! @param count The number of elements which will be stored in the container. 0518 //! 0519 //! @par Throws 0520 //! @li If T's value initialization throws. 0521 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0522 //! 0523 //! @par Complexity 0524 //! Linear O(N). 0525 void resize(size_type count); 0526 0527 //! @pre <tt>count <= capacity()</tt> 0528 //! 0529 //! @brief Inserts or erases elements at the end such that 0530 //! the size becomes count. New elements are default initialized. 0531 //! 0532 //! @param count The number of elements which will be stored in the container. 0533 //! 0534 //! @par Throws 0535 //! @li If T's default initialization throws. 0536 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0537 //! 0538 //! @par Complexity 0539 //! Linear O(N). 0540 //! 0541 //! @par Note 0542 //! Non-standard extension 0543 void resize(size_type count, default_init_t); 0544 0545 //! @pre <tt>count <= capacity()</tt> 0546 //! 0547 //! @brief Inserts or erases elements at the end such that 0548 //! the size becomes count. New elements are copy constructed from value. 0549 //! 0550 //! @param count The number of elements which will be stored in the container. 0551 //! @param value The value used to copy construct the new element. 0552 //! 0553 //! @par Throws 0554 //! @li If T's copy constructor throws. 0555 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0556 //! 0557 //! @par Complexity 0558 //! Linear O(N). 0559 void resize(size_type count, value_type const& value); 0560 0561 //! @pre <tt>count <= capacity()</tt> 0562 //! 0563 //! @brief This call has no effect because the Capacity of this container is constant. 0564 //! 0565 //! @param count The number of elements which the container should be able to contain. 0566 //! 0567 //! @par Throws 0568 //! If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0569 //! 0570 //! @par Complexity 0571 //! Constant O(1). 0572 void reserve(size_type count); 0573 0574 //! @pre <tt>size() < capacity()</tt> 0575 //! 0576 //! @brief Adds a copy of value at the end. 0577 //! 0578 //! @param value The value used to copy construct the new element. 0579 //! 0580 //! @par Throws 0581 //! @li If T's copy constructor throws. 0582 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0583 //! 0584 //! @par Complexity 0585 //! Constant O(1). 0586 void push_back(value_type const& value); 0587 0588 //! @pre <tt>size() < capacity()</tt> 0589 //! 0590 //! @brief Moves value to the end. 0591 //! 0592 //! @param value The value to move construct the new element. 0593 //! 0594 //! @par Throws 0595 //! @li If T's move constructor throws. 0596 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0597 //! 0598 //! @par Complexity 0599 //! Constant O(1). 0600 void push_back(BOOST_RV_REF(value_type) value); 0601 0602 //! @pre <tt>!empty()</tt> 0603 //! 0604 //! @brief Destroys last value and decreases the size. 0605 //! 0606 //! @par Throws 0607 //! Nothing. 0608 //! 0609 //! @par Complexity 0610 //! Constant O(1). 0611 void pop_back() BOOST_NOEXCEPT_OR_NOTHROW; 0612 0613 //! @pre 0614 //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. 0615 //! @li <tt>size() < capacity()</tt> 0616 //! 0617 //! @brief Inserts a copy of element at p. 0618 //! 0619 //! @param p The position at which the new value will be inserted. 0620 //! @param value The value used to copy construct the new element. 0621 //! 0622 //! @par Throws 0623 //! @li If T's copy constructor or copy assignment throws 0624 //! @li If T's move constructor or move assignment throws. 0625 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0626 //! 0627 //! @par Complexity 0628 //! Constant or linear. 0629 iterator insert(const_iterator p, value_type const& value); 0630 0631 //! @pre 0632 //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. 0633 //! @li <tt>size() < capacity()</tt> 0634 //! 0635 //! @brief Inserts a move-constructed element at p. 0636 //! 0637 //! @param p The position at which the new value will be inserted. 0638 //! @param value The value used to move construct the new element. 0639 //! 0640 //! @par Throws 0641 //! @li If T's move constructor or move assignment throws. 0642 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0643 //! 0644 //! @par Complexity 0645 //! Constant or linear. 0646 iterator insert(const_iterator p, BOOST_RV_REF(value_type) value); 0647 0648 //! @pre 0649 //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. 0650 //! @li <tt>size() + count <= capacity()</tt> 0651 //! 0652 //! @brief Inserts a count copies of value at p. 0653 //! 0654 //! @param p The position at which new elements will be inserted. 0655 //! @param count The number of new elements which will be inserted. 0656 //! @param value The value used to copy construct new elements. 0657 //! 0658 //! @par Throws 0659 //! @li If T's copy constructor or copy assignment throws. 0660 //! @li If T's move constructor or move assignment throws. 0661 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0662 //! 0663 //! @par Complexity 0664 //! Linear O(N). 0665 iterator insert(const_iterator p, size_type count, value_type const& value); 0666 0667 //! @pre 0668 //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. 0669 //! @li <tt>distance(first, last) <= capacity()</tt> 0670 //! @li \c Iterator must meet the \c ForwardTraversalIterator concept. 0671 //! 0672 //! @brief Inserts a copy of a range <tt>[first, last)</tt> at p. 0673 //! 0674 //! @param p The position at which new elements will be inserted. 0675 //! @param first The iterator to the first element of a range used to construct new elements. 0676 //! @param last The iterator to the one after the last element of a range used to construct new elements. 0677 //! 0678 //! @par Throws 0679 //! @li If T's constructor and assignment taking a dereferenced \c Iterator. 0680 //! @li If T's move constructor or move assignment throws. 0681 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0682 //! 0683 //! @par Complexity 0684 //! Linear O(N). 0685 template <typename Iterator> 0686 iterator insert(const_iterator p, Iterator first, Iterator last); 0687 0688 //! @pre 0689 //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. 0690 //! @li <tt>distance(il.begin(), il.end()) <= capacity()</tt> 0691 //! 0692 //! @brief Inserts a copy of a range <tt>[il.begin(), il.end())</tt> at p. 0693 //! 0694 //! @param p The position at which new elements will be inserted. 0695 //! @param il The std::initializer_list which contains elements that will be inserted. 0696 //! 0697 //! @par Throws 0698 //! @li If T's constructor and assignment taking a dereferenced std::initializer_list iterator. 0699 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0700 //! 0701 //! @par Complexity 0702 //! Linear O(N). 0703 iterator insert(const_iterator p, std::initializer_list<value_type> il); 0704 0705 //! @pre \c p must be a valid iterator of \c *this in range <tt>[begin(), end())</tt> 0706 //! 0707 //! @brief Erases T from p. 0708 //! 0709 //! @param p The position of the element which will be erased from the container. 0710 //! 0711 //! @par Throws 0712 //! If T's move assignment throws. 0713 //! 0714 //! @par Complexity 0715 //! Linear O(N). 0716 iterator erase(const_iterator p); 0717 0718 //! @pre 0719 //! @li \c first and \c last must define a valid range 0720 //! @li iterators must be in range <tt>[begin(), end()]</tt> 0721 //! 0722 //! @brief Erases Values from a range <tt>[first, last)</tt>. 0723 //! 0724 //! @param first The position of the first element of a range which will be erased from the container. 0725 //! @param last The position of the one after the last element of a range which will be erased from the container. 0726 //! 0727 //! @par Throws 0728 //! If T's move assignment throws. 0729 //! 0730 //! @par Complexity 0731 //! Linear O(N). 0732 iterator erase(const_iterator first, const_iterator last); 0733 0734 //! @pre <tt>distance(first, last) <= capacity()</tt> 0735 //! 0736 //! @brief Assigns a range <tt>[first, last)</tt> of Values to this container. 0737 //! 0738 //! @param first The iterator to the first element of a range used to construct new content of this container. 0739 //! @param last The iterator to the one after the last element of a range used to construct new content of this container. 0740 //! 0741 //! @par Throws 0742 //! @li If T's copy constructor or copy assignment throws, 0743 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0744 //! 0745 //! @par Complexity 0746 //! Linear O(N). 0747 template <typename Iterator> 0748 void assign(Iterator first, Iterator last); 0749 0750 //! @pre <tt>distance(il.begin(), il.end()) <= capacity()</tt> 0751 //! 0752 //! @brief Assigns a range <tt>[il.begin(), il.end())</tt> of Values to this container. 0753 //! 0754 //! @param il std::initializer_list with values used to construct new content of this container. 0755 //! 0756 //! @par Throws 0757 //! @li If T's copy constructor or copy assignment throws, 0758 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0759 //! 0760 //! @par Complexity 0761 //! Linear O(N). 0762 void assign(std::initializer_list<value_type> il); 0763 0764 //! @pre <tt>count <= capacity()</tt> 0765 //! 0766 //! @brief Assigns a count copies of value to this container. 0767 //! 0768 //! @param count The new number of elements which will be container in the container. 0769 //! @param value The value which will be used to copy construct the new content. 0770 //! 0771 //! @par Throws 0772 //! @li If T's copy constructor or copy assignment throws. 0773 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0774 //! 0775 //! @par Complexity 0776 //! Linear O(N). 0777 void assign(size_type count, value_type const& value); 0778 0779 //! @pre <tt>size() < capacity()</tt> 0780 //! 0781 //! @brief Inserts a T constructed with 0782 //! \c std::forward<Args>(args)... in the end of the container. 0783 //! 0784 //! @return A reference to the created object. 0785 //! 0786 //! @param args The arguments of the constructor of the new element which will be created at the end of the container. 0787 //! 0788 //! @par Throws 0789 //! @li If in-place constructor throws or T's move constructor throws. 0790 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0791 //! 0792 //! @par Complexity 0793 //! Constant O(1). 0794 template<class ...Args> 0795 reference emplace_back(Args &&...args); 0796 0797 //! @pre 0798 //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt> 0799 //! @li <tt>size() < capacity()</tt> 0800 //! 0801 //! @brief Inserts a T constructed with 0802 //! \c std::forward<Args>(args)... before p 0803 //! 0804 //! @param p The position at which new elements will be inserted. 0805 //! @param args The arguments of the constructor of the new element. 0806 //! 0807 //! @par Throws 0808 //! @li If in-place constructor throws or if T's move constructor or move assignment throws. 0809 //! @li If \c throw_on_overflow<true> option is set and the container runs out of capacity. 0810 //! 0811 //! @par Complexity 0812 //! Constant or linear. 0813 template<class ...Args> 0814 iterator emplace(const_iterator p, Args &&...args); 0815 0816 //! @brief Removes all elements from the container. 0817 //! 0818 //! @par Throws 0819 //! Nothing. 0820 //! 0821 //! @par Complexity 0822 //! Constant O(1). 0823 void clear() BOOST_NOEXCEPT_OR_NOTHROW; 0824 0825 //! @pre <tt>i < size()</tt> 0826 //! 0827 //! @brief Returns reference to the i-th element. 0828 //! 0829 //! @param i The element's index. 0830 //! 0831 //! @return reference to the i-th element 0832 //! from the beginning of the container. 0833 //! 0834 //! @par Throws 0835 //! \c out_of_range exception by default. 0836 //! 0837 //! @par Complexity 0838 //! Constant O(1). 0839 reference at(size_type i); 0840 0841 //! @pre <tt>i < size()</tt> 0842 //! 0843 //! @brief Returns const reference to the i-th element. 0844 //! 0845 //! @param i The element's index. 0846 //! 0847 //! @return const reference to the i-th element 0848 //! from the beginning of the container. 0849 //! 0850 //! @par Throws 0851 //! \c out_of_range exception by default. 0852 //! 0853 //! @par Complexity 0854 //! Constant O(1). 0855 const_reference at(size_type i) const; 0856 0857 //! @pre <tt>i < size()</tt> 0858 //! 0859 //! @brief Returns reference to the i-th element. 0860 //! 0861 //! @param i The element's index. 0862 //! 0863 //! @return reference to the i-th element 0864 //! from the beginning of the container. 0865 //! 0866 //! @par Throws 0867 //! Nothing. 0868 //! 0869 //! @par Complexity 0870 //! Constant O(1). 0871 reference operator[](size_type i) BOOST_NOEXCEPT_OR_NOTHROW; 0872 0873 //! @pre <tt>i < size()</tt> 0874 //! 0875 //! @brief Returns const reference to the i-th element. 0876 //! 0877 //! @param i The element's index. 0878 //! 0879 //! @return const reference to the i-th element 0880 //! from the beginning of the container. 0881 //! 0882 //! @par Throws 0883 //! Nothing. 0884 //! 0885 //! @par Complexity 0886 //! Constant O(1). 0887 const_reference operator[](size_type i) const BOOST_NOEXCEPT_OR_NOTHROW; 0888 0889 //! @pre <tt>i =< size()</tt> 0890 //! 0891 //! @brief Returns a iterator to the i-th element. 0892 //! 0893 //! @param i The element's index. 0894 //! 0895 //! @return a iterator to the i-th element. 0896 //! 0897 //! @par Throws 0898 //! Nothing. 0899 //! 0900 //! @par Complexity 0901 //! Constant O(1). 0902 iterator nth(size_type i) BOOST_NOEXCEPT_OR_NOTHROW; 0903 0904 //! @pre <tt>i =< size()</tt> 0905 //! 0906 //! @brief Returns a const_iterator to the i-th element. 0907 //! 0908 //! @param i The element's index. 0909 //! 0910 //! @return a const_iterator to the i-th element. 0911 //! 0912 //! @par Throws 0913 //! Nothing by default. 0914 //! 0915 //! @par Complexity 0916 //! Constant O(1). 0917 const_iterator nth(size_type i) const BOOST_NOEXCEPT_OR_NOTHROW; 0918 0919 //! @pre <tt>begin() <= p <= end()</tt> 0920 //! 0921 //! @brief Returns the index of the element pointed by p. 0922 //! 0923 //! @param p An iterator to the element. 0924 //! 0925 //! @return The index of the element pointed by p. 0926 //! 0927 //! @par Throws 0928 //! Nothing. 0929 //! 0930 //! @par Complexity 0931 //! Constant O(1). 0932 size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW; 0933 0934 //! @pre <tt>begin() <= p <= end()</tt> 0935 //! 0936 //! @brief Returns the index of the element pointed by p. 0937 //! 0938 //! @param p A const_iterator to the element. 0939 //! 0940 //! @return a const_iterator to the i-th element. 0941 //! 0942 //! @par Throws 0943 //! Nothing. 0944 //! 0945 //! @par Complexity 0946 //! Constant O(1). 0947 size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW; 0948 0949 //! @pre \c !empty() 0950 //! 0951 //! @brief Returns reference to the first element. 0952 //! 0953 //! @return reference to the first element 0954 //! from the beginning of the container. 0955 //! 0956 //! @par Throws 0957 //! Nothing. 0958 //! 0959 //! @par Complexity 0960 //! Constant O(1). 0961 reference front() BOOST_NOEXCEPT_OR_NOTHROW; 0962 0963 //! @pre \c !empty() 0964 //! 0965 //! @brief Returns const reference to the first element. 0966 //! 0967 //! @return const reference to the first element 0968 //! from the beginning of the container. 0969 //! 0970 //! @par Throws 0971 //! Nothing. 0972 //! 0973 //! @par Complexity 0974 //! Constant O(1). 0975 const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW; 0976 0977 //! @pre \c !empty() 0978 //! 0979 //! @brief Returns reference to the last element. 0980 //! 0981 //! @return reference to the last element 0982 //! from the beginning of the container. 0983 //! 0984 //! @par Throws 0985 //! Nothing. 0986 //! 0987 //! @par Complexity 0988 //! Constant O(1). 0989 reference back() BOOST_NOEXCEPT_OR_NOTHROW; 0990 0991 //! @pre \c !empty() 0992 //! 0993 //! @brief Returns const reference to the first element. 0994 //! 0995 //! @return const reference to the last element 0996 //! from the beginning of the container. 0997 //! 0998 //! @par Throws 0999 //! Nothing. 1000 //! 1001 //! @par Complexity 1002 //! Constant O(1). 1003 const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW; 1004 1005 //! @brief Pointer such that <tt>[data(), data() + size())</tt> is a valid range. 1006 //! For a non-empty vector <tt>data() == &front()</tt>. 1007 //! 1008 //! @par Throws 1009 //! Nothing. 1010 //! 1011 //! @par Complexity 1012 //! Constant O(1). 1013 T * data() BOOST_NOEXCEPT_OR_NOTHROW; 1014 1015 //! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range. 1016 //! For a non-empty vector <tt>data() == &front()</tt>. 1017 //! 1018 //! @par Throws 1019 //! Nothing. 1020 //! 1021 //! @par Complexity 1022 //! Constant O(1). 1023 const T * data() const BOOST_NOEXCEPT_OR_NOTHROW; 1024 1025 //! @brief Returns iterator to the first element. 1026 //! 1027 //! @return iterator to the first element contained in the vector. 1028 //! 1029 //! @par Throws 1030 //! Nothing. 1031 //! 1032 //! @par Complexity 1033 //! Constant O(1). 1034 iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; 1035 1036 //! @brief Returns const iterator to the first element. 1037 //! 1038 //! @return const_iterator to the first element contained in the vector. 1039 //! 1040 //! @par Throws 1041 //! Nothing. 1042 //! 1043 //! @par Complexity 1044 //! Constant O(1). 1045 const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW; 1046 1047 //! @brief Returns const iterator to the first element. 1048 //! 1049 //! @return const_iterator to the first element contained in the vector. 1050 //! 1051 //! @par Throws 1052 //! Nothing. 1053 //! 1054 //! @par Complexity 1055 //! Constant O(1). 1056 const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; 1057 1058 //! @brief Returns iterator to the one after the last element. 1059 //! 1060 //! @return iterator pointing to the one after the last element contained in the vector. 1061 //! 1062 //! @par Throws 1063 //! Nothing. 1064 //! 1065 //! @par Complexity 1066 //! Constant O(1). 1067 iterator end() BOOST_NOEXCEPT_OR_NOTHROW; 1068 1069 //! @brief Returns const iterator to the one after the last element. 1070 //! 1071 //! @return const_iterator pointing to the one after the last element contained in the vector. 1072 //! 1073 //! @par Throws 1074 //! Nothing. 1075 //! 1076 //! @par Complexity 1077 //! Constant O(1). 1078 const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; 1079 1080 //! @brief Returns const iterator to the one after the last element. 1081 //! 1082 //! @return const_iterator pointing to the one after the last element contained in the vector. 1083 //! 1084 //! @par Throws 1085 //! Nothing. 1086 //! 1087 //! @par Complexity 1088 //! Constant O(1). 1089 const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; 1090 1091 //! @brief Returns reverse iterator to the first element of the reversed container. 1092 //! 1093 //! @return reverse_iterator pointing to the beginning 1094 //! of the reversed static_vector. 1095 //! 1096 //! @par Throws 1097 //! Nothing. 1098 //! 1099 //! @par Complexity 1100 //! Constant O(1). 1101 reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; 1102 1103 //! @brief Returns const reverse iterator to the first element of the reversed container. 1104 //! 1105 //! @return const_reverse_iterator pointing to the beginning 1106 //! of the reversed static_vector. 1107 //! 1108 //! @par Throws 1109 //! Nothing. 1110 //! 1111 //! @par Complexity 1112 //! Constant O(1). 1113 const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; 1114 1115 //! @brief Returns const reverse iterator to the first element of the reversed container. 1116 //! 1117 //! @return const_reverse_iterator pointing to the beginning 1118 //! of the reversed static_vector. 1119 //! 1120 //! @par Throws 1121 //! Nothing. 1122 //! 1123 //! @par Complexity 1124 //! Constant O(1). 1125 const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; 1126 1127 //! @brief Returns reverse iterator to the one after the last element of the reversed container. 1128 //! 1129 //! @return reverse_iterator pointing to the one after the last element 1130 //! of the reversed static_vector. 1131 //! 1132 //! @par Throws 1133 //! Nothing. 1134 //! 1135 //! @par Complexity 1136 //! Constant O(1). 1137 reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; 1138 1139 //! @brief Returns const reverse iterator to the one after the last element of the reversed container. 1140 //! 1141 //! @return const_reverse_iterator pointing to the one after the last element 1142 //! of the reversed static_vector. 1143 //! 1144 //! @par Throws 1145 //! Nothing. 1146 //! 1147 //! @par Complexity 1148 //! Constant O(1). 1149 const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; 1150 1151 //! @brief Returns const reverse iterator to the one after the last element of the reversed container. 1152 //! 1153 //! @return const_reverse_iterator pointing to the one after the last element 1154 //! of the reversed static_vector. 1155 //! 1156 //! @par Throws 1157 //! Nothing. 1158 //! 1159 //! @par Complexity 1160 //! Constant O(1). 1161 const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; 1162 1163 #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED 1164 1165 //! @brief Returns container's capacity. 1166 //! 1167 //! @return container's capacity. 1168 //! 1169 //! @par Throws 1170 //! Nothing. 1171 //! 1172 //! @par Complexity 1173 //! Constant O(1). 1174 inline static size_type capacity() BOOST_NOEXCEPT_OR_NOTHROW 1175 { return static_capacity; } 1176 1177 //! @brief Returns container's capacity. 1178 //! 1179 //! @return container's capacity. 1180 //! 1181 //! @par Throws 1182 //! Nothing. 1183 //! 1184 //! @par Complexity 1185 //! Constant O(1). 1186 inline static size_type max_size() BOOST_NOEXCEPT_OR_NOTHROW 1187 { return static_capacity; } 1188 1189 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED 1190 1191 //! @brief Returns the number of stored elements. 1192 //! 1193 //! @return Number of elements contained in the container. 1194 //! 1195 //! @par Throws 1196 //! Nothing. 1197 //! 1198 //! @par Complexity 1199 //! Constant O(1). 1200 size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; 1201 1202 //! @brief Queries if the container contains elements. 1203 //! 1204 //! @return true if the number of elements contained in the 1205 //! container is equal to 0. 1206 //! 1207 //! @par Throws 1208 //! Nothing. 1209 //! 1210 //! @par Complexity 1211 //! Constant O(1). 1212 bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; 1213 #else 1214 1215 inline friend void swap(static_vector &x, static_vector &y) 1216 BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))) 1217 { 1218 x.swap(y); 1219 } 1220 1221 #endif // BOOST_CONTAINER_DOXYGEN_INVOKED 1222 1223 }; 1224 1225 #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED 1226 1227 //! @brief Checks if contents of two static_vectors are equal. 1228 //! 1229 //! @ingroup static_vector_non_member 1230 //! 1231 //! @param x The first static_vector. 1232 //! @param y The second static_vector. 1233 //! 1234 //! @return \c true if containers have the same size and elements in both containers are equal. 1235 //! 1236 //! @par Complexity 1237 //! Linear O(N). 1238 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1239 bool operator== (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y); 1240 1241 //! @brief Checks if contents of two static_vectors are not equal. 1242 //! 1243 //! @ingroup static_vector_non_member 1244 //! 1245 //! @param x The first static_vector. 1246 //! @param y The second static_vector. 1247 //! 1248 //! @return \c true if containers have different size or elements in both containers are not equal. 1249 //! 1250 //! @par Complexity 1251 //! Linear O(N). 1252 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1253 bool operator!= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y); 1254 1255 //! @brief Lexicographically compares static_vectors. 1256 //! 1257 //! @ingroup static_vector_non_member 1258 //! 1259 //! @param x The first static_vector. 1260 //! @param y The second static_vector. 1261 //! 1262 //! @return \c true if x compares lexicographically less than y. 1263 //! 1264 //! @par Complexity 1265 //! Linear O(N). 1266 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1267 bool operator< (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y); 1268 1269 //! @brief Lexicographically compares static_vectors. 1270 //! 1271 //! @ingroup static_vector_non_member 1272 //! 1273 //! @param x The first static_vector. 1274 //! @param y The second static_vector. 1275 //! 1276 //! @return \c true if y compares lexicographically less than x. 1277 //! 1278 //! @par Complexity 1279 //! Linear O(N). 1280 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1281 bool operator> (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y); 1282 1283 //! @brief Lexicographically compares static_vectors. 1284 //! 1285 //! @ingroup static_vector_non_member 1286 //! 1287 //! @param x The first static_vector. 1288 //! @param y The second static_vector. 1289 //! 1290 //! @return \c true if y don't compare lexicographically less than x. 1291 //! 1292 //! @par Complexity 1293 //! Linear O(N). 1294 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1295 bool operator<= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y); 1296 1297 //! @brief Lexicographically compares static_vectors. 1298 //! 1299 //! @ingroup static_vector_non_member 1300 //! 1301 //! @param x The first static_vector. 1302 //! @param y The second static_vector. 1303 //! 1304 //! @return \c true if x don't compare lexicographically less than y. 1305 //! 1306 //! @par Complexity 1307 //! Linear O(N). 1308 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1309 bool operator>= (static_vector<V, C1, O1> const& x, static_vector<V, C2, O2> const& y); 1310 1311 //! @brief Swaps contents of two static_vectors. 1312 //! 1313 //! This function calls static_vector::swap(). 1314 //! 1315 //! @ingroup static_vector_non_member 1316 //! 1317 //! @param x The first static_vector. 1318 //! @param y The second static_vector. 1319 //! 1320 //! @par Complexity 1321 //! Linear O(N). 1322 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1323 inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y) 1324 BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))); 1325 1326 #else 1327 1328 template<typename V, std::size_t C1, std::size_t C2, class O1, class O2> 1329 inline void swap(static_vector<V, C1, O1> & x, static_vector<V, C2, O2> & y 1330 , typename dtl::enable_if_c< C1 != C2>::type * = 0) 1331 BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT(x.swap(y))) 1332 { 1333 x.swap(y); 1334 } 1335 1336 #endif // BOOST_CONTAINER_DOXYGEN_INVOKED 1337 1338 }} // namespace boost::container 1339 1340 #include <boost/container/detail/config_end.hpp> 1341 1342 #endif // BOOST_CONTAINER_STATIC_VECTOR_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|