diff --git a/bench/bench_vectors.cpp b/bench/bench_vectors.cpp index 9def103..2a84757 100644 --- a/bench/bench_vectors.cpp +++ b/bench/bench_vectors.cpp @@ -22,6 +22,11 @@ #include #include +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + //capacity #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME capacity #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace test { @@ -30,6 +35,11 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 #include +//#pragma GCC diagnostic ignored "-Wunused-result" +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic pop +#endif + using boost::move_detail::cpu_timer; using boost::move_detail::cpu_times; using boost::move_detail::nanosecond_type; diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index dedb9c1..9b0a167 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -40,6 +40,8 @@ doxygen autodoc \"BOOST_RV_REF_END_IF_CXX11=&&\" \\ \"BOOST_COPY_ASSIGN_REF(T)=const T &\" \\ \"BOOST_FWD_REF(a)=a &&\" \\ + \"BOOST_CONTAINER_ATTRIBUTE_NODISCARD=[[nodiscard]] \" \\ + \"BOOST_NORETURN=[[noreturn]] \" \\ \"BOOST_INTRUSIVE_OPTION_CONSTANT(OPTION_NAME, TYPE, VALUE, CONSTANT_NAME) = template struct OPTION_NAME{};\" \\ \"BOOST_INTRUSIVE_OPTION_TYPE(OPTION_NAME, TYPE, TYPEDEF_EXPR, TYPEDEF_NAME) = template struct OPTION_NAME{};\" \\ \"BOOST_CONTAINER_DOC1ST(T1, T2)=T1\" \\ diff --git a/include/boost/container/allocator.hpp b/include/boost/container/allocator.hpp index 899f85e..195a523 100644 --- a/include/boost/container/allocator.hpp +++ b/include/boost/container/allocator.hpp @@ -177,7 +177,7 @@ class allocator //!Throws std::bad_alloc if there is no enough memory //!If Version is 2, this allocated memory can only be deallocated //!with deallocate() or (for Version == 2) deallocate_many() - pointer allocate(size_type count, const void * hint= 0) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD pointer allocate(size_type count, const void * hint= 0) { (void)hint; if(count > size_type(-1)/(2u*sizeof(T))) @@ -205,19 +205,21 @@ class allocator //!An allocator always compares to true, as memory allocated with one //!instance can be deallocated by another instance - friend bool operator==(const allocator &, const allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD + friend bool operator==(const allocator &, const allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return true; } //!An allocator always compares to false, as memory allocated with one //!instance can be deallocated by another instance - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const allocator &, const allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const allocator &, const allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return false; } //!An advanced function that offers in-place expansion shrink to fit and new allocation //!capabilities. Memory allocated with this function can only be deallocated with deallocate() //!or deallocate_many(). //!This function is available only with Version == 2 - pointer allocation_command(allocation_type command, + BOOST_CONTAINER_ATTRIBUTE_NODISCARD pointer allocation_command(allocation_type command, size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) @@ -236,7 +238,7 @@ class allocator //!Memory must not have been allocated with //!allocate_one or allocate_individual. //!This function is available only with Version == 2 - size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_STATIC_ASSERT(( Version > 1 )); return dlmalloc_size(p); @@ -246,7 +248,7 @@ class allocator //!must be deallocated only with deallocate_one(). //!Throws bad_alloc if there is no enough memory //!This function is available only with Version == 2 - BOOST_CONTAINER_FORCEINLINE pointer allocate_one() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE pointer allocate_one() { BOOST_STATIC_ASSERT(( Version > 1 )); return this->allocate(1); @@ -273,7 +275,8 @@ class allocator //!Deallocates memory allocated with allocate_one() or allocate_individual(). //!This function is available only with Version == 2 - BOOST_CONTAINER_FORCEINLINE void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE + void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_STATIC_ASSERT(( Version > 1 )); return this->deallocate_many(chain); diff --git a/include/boost/container/allocator_traits.hpp b/include/boost/container/allocator_traits.hpp index 72d90d1..c25921c 100644 --- a/include/boost/container/allocator_traits.hpp +++ b/include/boost/container/allocator_traits.hpp @@ -49,6 +49,11 @@ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} @@ -70,6 +75,10 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9 #include +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic pop +#endif + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index cea31e3..9ebb2ea 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -142,10 +142,10 @@ class deque_iterator public: - BOOST_CONTAINER_FORCEINLINE Pointer get_cur() const { return m_cur; } - BOOST_CONTAINER_FORCEINLINE Pointer get_first() const { return m_first; } - BOOST_CONTAINER_FORCEINLINE Pointer get_last() const { return m_last; } - BOOST_CONTAINER_FORCEINLINE index_pointer get_node() const { return m_node; } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE Pointer get_cur() const { return m_cur; } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE Pointer get_first() const { return m_first; } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE Pointer get_last() const { return m_last; } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE index_pointer get_node() const { return m_node; } BOOST_CONTAINER_FORCEINLINE deque_iterator(val_alloc_ptr x, index_pointer y, difference_type block_size) BOOST_NOEXCEPT_OR_NOTHROW : m_cur(x), m_first(*y), m_last(*y + block_size), m_node(y) @@ -181,7 +181,7 @@ class deque_iterator BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW { return this->m_cur; } - difference_type operator-(const deque_iterator& x) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD difference_type operator-(const deque_iterator& x) const BOOST_NOEXCEPT_OR_NOTHROW { if(!this->m_cur && !x.m_cur){ return 0; @@ -253,45 +253,56 @@ class deque_iterator return *this; } - BOOST_CONTAINER_FORCEINLINE deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW { deque_iterator tmp(*this); return tmp += n; } - BOOST_CONTAINER_FORCEINLINE deque_iterator& operator-=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE + deque_iterator& operator-=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW { return *this += -n; } - BOOST_CONTAINER_FORCEINLINE deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW { deque_iterator tmp(*this); return tmp -= n; } - BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW { return *(*this + n); } - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_cur == r.m_cur; } - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_cur != r.m_cur; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return (l.m_node == r.m_node) ? (l.m_cur < r.m_cur) : (l.m_node < r.m_node); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return r < l; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return !(r < l); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return !(l < r); } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW + { return x += n; } + BOOST_CONTAINER_FORCEINLINE void priv_set_node(index_pointer new_node, difference_type block_size) BOOST_NOEXCEPT_OR_NOTHROW { this->m_node = new_node; this->m_first = *new_node; this->m_last = this->m_first + block_size; } - - BOOST_CONTAINER_FORCEINLINE friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW - { return x += n; } }; } //namespace dtl { @@ -575,7 +586,8 @@ class deque : protected deque_base::type, //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE deque() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) + BOOST_CONTAINER_FORCEINLINE deque() + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : Base() {} @@ -963,7 +975,8 @@ class deque : protected deque_base::type, //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return Base::alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -973,7 +986,8 @@ class deque : protected deque_base::type, //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return Base::alloc(); } ////////////////////////////////////////////// @@ -989,7 +1003,8 @@ class deque : protected deque_base::type, //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return Base::alloc(); } //! Effects: Returns an iterator to the first element contained in the deque. @@ -997,7 +1012,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_start; } //! Effects: Returns a const_iterator to the first element contained in the deque. @@ -1005,7 +1021,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_start; } //! Effects: Returns an iterator to the end of the deque. @@ -1013,7 +1030,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_finish; } //! Effects: Returns a const_iterator to the end of the deque. @@ -1021,7 +1039,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_finish; } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -1030,7 +1049,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->members_.m_finish); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1039,7 +1059,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->members_.m_finish); } //! Effects: Returns a reverse_iterator pointing to the end @@ -1048,7 +1069,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->members_.m_start); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1057,7 +1079,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->members_.m_start); } //! Effects: Returns a const_iterator to the first element contained in the deque. @@ -1065,7 +1088,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_start; } //! Effects: Returns a const_iterator to the end of the deque. @@ -1073,7 +1097,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_finish; } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1082,7 +1107,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->members_.m_finish); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1091,7 +1117,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->members_.m_start); } ////////////////////////////////////////////// @@ -1105,7 +1132,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_finish == this->members_.m_start; } //! Effects: Returns the number of the elements contained in the deque. @@ -1113,7 +1141,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { return this->members_.m_finish - this->members_.m_start; } //! Effects: Returns the largest possible size of the deque. @@ -1121,7 +1150,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_traits_type::max_size(this->alloc()); } //! Effects: Inserts or erases elements at the end such that @@ -1208,7 +1238,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->members_.m_start; @@ -1222,7 +1253,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->members_.m_start; @@ -1236,7 +1268,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(end()-1); @@ -1250,7 +1283,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(cend()-1); @@ -1264,7 +1298,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() > n); return this->members_.m_start[difference_type(n)]; @@ -1278,7 +1313,8 @@ class deque : protected deque_base::type, //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() > n); return this->members_.m_start[difference_type(n)]; @@ -1295,7 +1331,8 @@ class deque : protected deque_base::type, //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() >= n); return iterator(this->begin()+n); @@ -1312,7 +1349,8 @@ class deque : protected deque_base::type, //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() >= n); return const_iterator(this->cbegin()+n); @@ -1328,7 +1366,8 @@ class deque : protected deque_base::type, //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { //Range checked priv_index_of return this->priv_index_of(p); @@ -1344,7 +1383,8 @@ class deque : protected deque_base::type, //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { //Range checked priv_index_of return this->priv_index_of(p); @@ -1358,7 +1398,8 @@ class deque : protected deque_base::type, //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference at(size_type n) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference at(size_type n) { this->priv_throw_if_out_of_range(n); return (*this)[n]; @@ -1372,7 +1413,8 @@ class deque : protected deque_base::type, //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reference at(size_type n) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference at(size_type n) const { this->priv_throw_if_out_of_range(n); return (*this)[n]; @@ -1822,37 +1864,43 @@ class deque : protected deque_base::type, //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const deque& x, const deque& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const deque& x, const deque& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const deque& x, const deque& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const deque& x, const deque& y) { return !(x == y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const deque& x, const deque& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const deque& x, const deque& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const deque& x, const deque& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const deque& x, const deque& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const deque& x, const deque& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const deque& x, const deque& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const deque& x, const deque& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const deque& x, const deque& y) { return !(x < y); } //! Effects: x.swap(y) diff --git a/include/boost/container/detail/flat_tree.hpp b/include/boost/container/detail/flat_tree.hpp index a8bcfd8..8debd6f 100644 --- a/include/boost/container/detail/flat_tree.hpp +++ b/include/boost/container/detail/flat_tree.hpp @@ -55,6 +55,11 @@ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + //merge_unique #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge_unique #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { @@ -103,6 +108,11 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 #include +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic pop +#endif + + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED namespace boost { @@ -726,68 +736,88 @@ class flat_tree public: // accessors: - BOOST_CONTAINER_FORCEINLINE Compare key_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + Compare key_comp() const { return this->m_data.get_comp(); } - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + value_compare value_comp() const { return this->m_data; } - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const { return this->m_data.m_seq.get_allocator(); } - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + get_stored_allocator_const_return_t get_stored_allocator() const { return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + get_stored_allocator_noconst_return_t get_stored_allocator() { return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE iterator begin() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() { return this->m_data.m_seq.begin(); } - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const { return this->cbegin(); } - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const { return this->m_data.m_seq.begin(); } - BOOST_CONTAINER_FORCEINLINE iterator end() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() { return this->m_data.m_seq.end(); } - BOOST_CONTAINER_FORCEINLINE const_iterator end() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const { return this->cend(); } - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const { return this->m_data.m_seq.end(); } - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() { return reverse_iterator(this->end()); } - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const { return this->crbegin(); } - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const { return const_reverse_iterator(this->cend()); } - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() { return reverse_iterator(this->begin()); } - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const { return this->crend(); } - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const { return const_reverse_iterator(this->cbegin()); } - BOOST_CONTAINER_FORCEINLINE bool empty() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const { return this->m_data.m_seq.empty(); } - BOOST_CONTAINER_FORCEINLINE size_type size() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const { return this->m_data.m_seq.size(); } - BOOST_CONTAINER_FORCEINLINE size_type max_size() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const { return this->m_data.m_seq.max_size(); } BOOST_CONTAINER_FORCEINLINE void swap(flat_tree& other) @@ -1116,21 +1146,24 @@ class flat_tree return flat_tree_nth(this->m_data.m_seq, n, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { const bool value = boost::container::dtl:: has_member_function_callable_with_nth::value; return flat_tree_nth(this->m_data.m_seq, n, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { const bool value = boost::container::dtl:: has_member_function_callable_with_index_of::value; return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { const bool value = boost::container::dtl:: has_member_function_callable_with_index_of::value; @@ -1138,7 +1171,8 @@ class flat_tree } // set operations: - iterator find(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD + iterator find(const key_type& k) { iterator i = this->lower_bound(k); iterator end_it = this->end(); @@ -1148,6 +1182,7 @@ class flat_tree return i; } + BOOST_CONTAINER_ATTRIBUTE_NODISCARD const_iterator find(const key_type& k) const { const_iterator i = this->lower_bound(k); @@ -1160,7 +1195,8 @@ class flat_tree } template - typename dtl::enable_if_transparent::type + BOOST_CONTAINER_ATTRIBUTE_NODISCARD + typename dtl::enable_if_transparent::type find(const K& k) { iterator i = this->lower_bound(k); @@ -1172,7 +1208,8 @@ class flat_tree } template - typename dtl::enable_if_transparent::type + BOOST_CONTAINER_ATTRIBUTE_NODISCARD + typename dtl::enable_if_transparent::type find(const K& k) const { const_iterator i = this->lower_bound(k); @@ -1184,7 +1221,8 @@ class flat_tree return i; } - size_type count(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD + size_type count(const key_type& k) const { std::pair p = this->equal_range(k); size_type n = p.second - p.first; @@ -1192,7 +1230,8 @@ class flat_tree } template - typename dtl::enable_if_transparent::type + BOOST_CONTAINER_ATTRIBUTE_NODISCARD + typename dtl::enable_if_transparent::type count(const K& k) const { std::pair p = this->equal_range(k); @@ -1200,11 +1239,11 @@ class flat_tree return n; } - BOOST_CONTAINER_FORCEINLINE bool contains(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE bool contains(const key_type& x) const { return this->find(x) != this->cend(); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type contains(const K& x) const { return this->find(x) != this->cend(); } @@ -1247,99 +1286,111 @@ class flat_tree , dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator lower_bound(const key_type& k) { return this->priv_lower_bound(this->begin(), this->end(), k); } - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator lower_bound(const key_type& k) const { return this->priv_lower_bound(this->cbegin(), this->cend(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type lower_bound(const K& k) { return this->priv_lower_bound(this->begin(), this->end(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type lower_bound(const K& k) const { return this->priv_lower_bound(this->cbegin(), this->cend(), k); } - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator upper_bound(const key_type& k) { return this->priv_upper_bound(this->begin(), this->end(), k); } - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator upper_bound(const key_type& k) const { return this->priv_upper_bound(this->cbegin(), this->cend(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type upper_bound(const K& k) { return this->priv_upper_bound(this->begin(), this->end(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type upper_bound(const K& k) const { return this->priv_upper_bound(this->cbegin(), this->cend(), k); } - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& k) { return this->priv_equal_range(this->begin(), this->end(), k); } - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& k) const { return this->priv_equal_range(this->cbegin(), this->cend(), k); } template - BOOST_CONTAINER_FORCEINLINE - typename dtl::enable_if_transparent >::type + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type equal_range(const K& k) { return this->priv_equal_range(this->begin(), this->end(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type equal_range(const K& k) const { return this->priv_equal_range(this->cbegin(), this->cend(), k); } - BOOST_CONTAINER_FORCEINLINE std::pair lower_bound_range(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair lower_bound_range(const key_type& k) { return this->priv_lower_bound_range(this->begin(), this->end(), k); } - BOOST_CONTAINER_FORCEINLINE std::pair lower_bound_range(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair lower_bound_range(const key_type& k) const { return this->priv_lower_bound_range(this->cbegin(), this->cend(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type lower_bound_range(const K& k) { return this->priv_lower_bound_range(this->begin(), this->end(), k); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type lower_bound_range(const K& k) const { return this->priv_lower_bound_range(this->cbegin(), this->cend(), k); } - BOOST_CONTAINER_FORCEINLINE size_type capacity() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type capacity() const { const bool value = boost::container::dtl:: has_member_function_callable_with_capacity::value; return (flat_tree_capacity)(this->m_data.m_seq, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE void reserve(size_type cnt) + BOOST_CONTAINER_FORCEINLINE + void reserve(size_type cnt) { const bool value = boost::container::dtl:: has_member_function_callable_with_reserve::value; (flat_tree_reserve)(this->m_data.m_seq, cnt, dtl::bool_()); } - BOOST_CONTAINER_FORCEINLINE container_type extract_sequence() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + container_type extract_sequence() { return boost::move(m_data.m_seq); } - BOOST_CONTAINER_FORCEINLINE container_type &get_sequence_ref() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + container_type &get_sequence_ref() { return m_data.m_seq; } @@ -1368,26 +1419,32 @@ class flat_tree m_data.m_seq = boost::move(seq); } - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const flat_tree& x, const flat_tree& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const flat_tree& x, const flat_tree& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const flat_tree& x, const flat_tree& y) { return !(x == y); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const flat_tree& x, const flat_tree& y) { return y < x; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const flat_tree& x, const flat_tree& y) { return !(y < x); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_tree& x, const flat_tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const flat_tree& x, const flat_tree& y) { return !(x < y); } BOOST_CONTAINER_FORCEINLINE friend void swap(flat_tree& x, flat_tree& y) diff --git a/include/boost/container/detail/is_container.hpp b/include/boost/container/detail/is_container.hpp index 7181c7f..461e497 100644 --- a/include/boost/container/detail/is_container.hpp +++ b/include/boost/container/detail/is_container.hpp @@ -18,6 +18,11 @@ # pragma once #endif +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + //empty #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME empty #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_container_detail { @@ -34,6 +39,11 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 #include +//#pragma GCC diagnostic ignored "-Wunused-result" +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic pop +#endif + namespace boost { namespace container { namespace dtl { diff --git a/include/boost/container/detail/is_contiguous_container.hpp b/include/boost/container/detail/is_contiguous_container.hpp index 47ab363..a44cee0 100644 --- a/include/boost/container/detail/is_contiguous_container.hpp +++ b/include/boost/container/detail/is_contiguous_container.hpp @@ -18,6 +18,11 @@ # pragma once #endif +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + //data #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME data #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_contiguous_container_detail { @@ -34,6 +39,11 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 #include +//#pragma GCC diagnostic ignored "-Wunused-result" +#if defined(BOOST_GCC) && (BOOST_GCC >= 40500) +#pragma GCC diagnostic pop +#endif + namespace boost { namespace container { namespace dtl { diff --git a/include/boost/container/detail/tree.hpp b/include/boost/container/detail/tree.hpp index e8df720..a4b99fd 100644 --- a/include/boost/container/detail/tree.hpp +++ b/include/boost/container/detail/tree.hpp @@ -864,43 +864,57 @@ class tree public: // accessors: - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + value_compare value_comp() const { return this->icont().value_comp().predicate(); } - BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + key_compare key_comp() const { return this->icont().value_comp().predicate().key_comp(); } - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const { return allocator_type(this->node_alloc()); } - BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const stored_allocator_type &get_stored_allocator() const { return this->node_alloc(); } - BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + stored_allocator_type &get_stored_allocator() { return this->node_alloc(); } - BOOST_CONTAINER_FORCEINLINE iterator begin() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() { return iterator(this->icont().begin()); } - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const { return this->cbegin(); } - BOOST_CONTAINER_FORCEINLINE iterator end() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() { return iterator(this->icont().end()); } - BOOST_CONTAINER_FORCEINLINE const_iterator end() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const { return this->cend(); } - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() { return reverse_iterator(end()); } - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const + + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const { return this->crbegin(); } - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() { return reverse_iterator(begin()); } - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const { return this->crend(); } //! Effects: Returns a const_iterator to the first element contained in the container. @@ -908,7 +922,8 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const { return const_iterator(this->non_const_icont().begin()); } //! Effects: Returns a const_iterator to the end of the container. @@ -916,7 +931,8 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const { return const_iterator(this->non_const_icont().end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -925,7 +941,8 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const { return const_reverse_iterator(cend()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -934,16 +951,20 @@ class tree //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const { return const_reverse_iterator(cbegin()); } - BOOST_CONTAINER_FORCEINLINE bool empty() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const { return !this->size(); } - BOOST_CONTAINER_FORCEINLINE size_type size() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const { return this->icont().size(); } - BOOST_CONTAINER_FORCEINLINE size_type max_size() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const { return AllocHolder::max_size(); } BOOST_CONTAINER_FORCEINLINE void swap(ThisType& x) @@ -1331,86 +1352,96 @@ class tree // search operations. Const and non-const overloads even if no iterator is returned // so splay implementations can to their rebalancing when searching in non-const versions - BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator find(const key_type& k) { return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); } - BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator find(const key_type& k) const { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type find(const K& k) { return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type find(const K& k) const { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); } - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const key_type& k) const { return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type count(const K& k) const { return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); } - BOOST_CONTAINER_FORCEINLINE bool contains(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool contains(const key_type& x) const { return this->find(x) != this->cend(); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type contains(const K& x) const { return this->find(x) != this->cend(); } - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator lower_bound(const key_type& k) { return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); } - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator lower_bound(const key_type& k) const { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type lower_bound(const K& k) { return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type lower_bound(const K& k) const { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); } - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator upper_bound(const key_type& k) { return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); } - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator upper_bound(const key_type& k) const { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type upper_bound(const K& k) { return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent::type upper_bound(const K& k) const { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); } - std::pair equal_range(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& k) { std::pair ret = this->icont().equal_range(k, KeyNodeCompare(key_comp())); return std::pair(iterator(ret.first), iterator(ret.second)); } - std::pair equal_range(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& k) const { std::pair ret = this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp())); @@ -1419,7 +1450,7 @@ class tree } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type equal_range(const K& k) { @@ -1429,7 +1460,7 @@ class tree } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type equal_range(const K& k) const { @@ -1439,14 +1470,16 @@ class tree (const_iterator(ret.first), const_iterator(ret.second)); } - std::pair lower_bound_range(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair lower_bound_range(const key_type& k) { std::pair ret = this->icont().lower_bound_range(k, KeyNodeCompare(key_comp())); return std::pair(iterator(ret.first), iterator(ret.second)); } - std::pair lower_bound_range(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair lower_bound_range(const key_type& k) const { std::pair ret = this->non_const_icont().lower_bound_range(k, KeyNodeCompare(key_comp())); @@ -1455,7 +1488,7 @@ class tree } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type lower_bound_range(const K& k) { @@ -1465,7 +1498,7 @@ class tree } template - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_transparent >::type lower_bound_range(const K& k) const { @@ -1478,22 +1511,28 @@ class tree BOOST_CONTAINER_FORCEINLINE void rebalance() { intrusive_tree_proxy_t::rebalance(this->icont()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const tree& x, const tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const tree& x, const tree& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const tree& x, const tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const tree& x, const tree& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const tree& x, const tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const tree& x, const tree& y) { return !(x == y); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const tree& x, const tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const tree& x, const tree& y) { return y < x; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const tree& x, const tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const tree& x, const tree& y) { return !(y < x); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const tree& x, const tree& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const tree& x, const tree& y) { return !(x < y); } BOOST_CONTAINER_FORCEINLINE friend void swap(tree& x, tree& y) diff --git a/include/boost/container/detail/workaround.hpp b/include/boost/container/detail/workaround.hpp index b74e0fc..f7d08cb 100644 --- a/include/boost/container/detail/workaround.hpp +++ b/include/boost/container/detail/workaround.hpp @@ -139,4 +139,16 @@ #define BOOST_CONTAINER_NO_CXX17_CTAD #endif +#if defined(BOOST_CONTAINER_DISABLE_ATTRIBUTE_NODISCARD) + #define BOOST_CONTAINER_ATTRIBUTE_NODISCARD +#else + #if defined(BOOST_GCC) && ((BOOST_GCC < 100000) || (__cplusplus < 201703L)) + //Avoid using it in C++ < 17 and GCC < 10 because it warns in SFINAE contexts + //(see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89070) + #define BOOST_CONTAINER_ATTRIBUTE_NODISCARD + #else + #define BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_ATTRIBUTE_NODISCARD + #endif +#endif + #endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/include/boost/container/devector.hpp b/include/boost/container/devector.hpp index 2b56829..84d48e4 100644 --- a/include/boost/container/devector.hpp +++ b/include/boost/container/devector.hpp @@ -748,17 +748,20 @@ class devector * * **Complexity**: Constant. */ - allocator_type get_allocator() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const BOOST_NOEXCEPT { return static_cast(m_); } - const allocator_type &get_stored_allocator() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const allocator_type &get_stored_allocator() const BOOST_NOEXCEPT { return static_cast(m_); } - allocator_type &get_stored_allocator() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type &get_stored_allocator() BOOST_NOEXCEPT { return static_cast(m_); } @@ -771,7 +774,8 @@ class devector * * **Complexity**: Constant. */ - iterator begin() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT { return m_.buffer + m_.front_idx; } @@ -782,7 +786,8 @@ class devector * * **Complexity**: Constant. */ - const_iterator begin() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT { return m_.buffer + m_.front_idx; } @@ -792,7 +797,8 @@ class devector * * **Complexity**: Constant. */ - iterator end() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT { return m_.buffer + m_.back_idx; } @@ -802,7 +808,8 @@ class devector * * **Complexity**: Constant. */ - const_iterator end() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT { return m_.buffer + m_.back_idx; } @@ -813,7 +820,8 @@ class devector * * **Complexity**: Constant. */ - reverse_iterator rbegin() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() BOOST_NOEXCEPT { return reverse_iterator(m_.buffer + m_.back_idx); } @@ -825,7 +833,8 @@ class devector * * **Complexity**: Constant. */ - const_reverse_iterator rbegin() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const BOOST_NOEXCEPT { return const_reverse_iterator(m_.buffer + m_.back_idx); } @@ -836,7 +845,8 @@ class devector * * **Complexity**: Constant. */ - reverse_iterator rend() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() BOOST_NOEXCEPT { return reverse_iterator(m_.buffer + m_.front_idx); } @@ -847,7 +857,8 @@ class devector * * **Complexity**: Constant. */ - const_reverse_iterator rend() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const BOOST_NOEXCEPT { return const_reverse_iterator(m_.buffer + m_.front_idx); } @@ -858,7 +869,8 @@ class devector * * **Complexity**: Constant. */ - const_iterator cbegin() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT { return m_.buffer + m_.front_idx; } @@ -880,7 +892,8 @@ class devector * * **Complexity**: Constant. */ - const_reverse_iterator crbegin() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const BOOST_NOEXCEPT { return const_reverse_iterator(m_.buffer + m_.back_idx); } @@ -891,7 +904,8 @@ class devector * * **Complexity**: Constant. */ - const_reverse_iterator crend() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const BOOST_NOEXCEPT { return const_reverse_iterator(m_.buffer + m_.front_idx); } @@ -903,7 +917,8 @@ class devector * * **Complexity**: Constant. */ - bool empty() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const BOOST_NOEXCEPT { return m_.front_idx == m_.back_idx; } @@ -913,7 +928,8 @@ class devector * * **Complexity**: Constant. */ - size_type size() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const BOOST_NOEXCEPT { return m_.back_idx - m_.front_idx; } @@ -923,7 +939,8 @@ class devector * * **Complexity**: Constant. */ - size_type max_size() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const BOOST_NOEXCEPT { size_type alloc_max = allocator_traits_type::max_size(get_allocator_ref()); size_type size_type_max = (size_type)-1; @@ -935,7 +952,8 @@ class devector * * **Complexity**: Constant. */ - size_type capacity() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type capacity() const BOOST_NOEXCEPT { return m_.capacity; } @@ -946,7 +964,8 @@ class devector * * **Complexity**: Constant. */ - size_type front_free_capacity() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type front_free_capacity() const BOOST_NOEXCEPT { return m_.front_idx; } @@ -957,7 +976,8 @@ class devector * * **Complexity**: Constant. */ - size_type back_free_capacity() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type back_free_capacity() const BOOST_NOEXCEPT { return m_.capacity - m_.back_idx; } @@ -1212,10 +1232,10 @@ class devector * * **Complexity**: Constant. */ - reference operator[](size_type n) BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator[](size_type n) BOOST_NOEXCEPT { BOOST_ASSERT(n < size()); - return *(begin() + n); } @@ -1226,7 +1246,8 @@ class devector * * **Complexity**: Constant. */ - const_reference operator[](size_type n) const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference operator[](size_type n) const BOOST_NOEXCEPT { BOOST_ASSERT(n < size()); @@ -1240,7 +1261,8 @@ class devector * * **Complexity**: Constant. */ - reference at(size_type n) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference at(size_type n) { if (size() <= n) throw_out_of_range("devector::at out of range"); @@ -1254,7 +1276,8 @@ class devector * * **Complexity**: Constant. */ - const_reference at(size_type n) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference at(size_type n) const { if (size() <= n) throw_out_of_range("devector::at out of range"); @@ -1268,7 +1291,8 @@ class devector * * **Complexity**: Constant. */ - reference front() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference front() BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); @@ -1282,7 +1306,8 @@ class devector * * **Complexity**: Constant. */ - const_reference front() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference front() const BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); @@ -1296,7 +1321,8 @@ class devector * * **Complexity**: Constant. */ - reference back() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference back() BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); @@ -1310,7 +1336,8 @@ class devector * * **Complexity**: Constant. */ - const_reference back() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference back() const BOOST_NOEXCEPT { BOOST_ASSERT(!empty()); @@ -1324,7 +1351,8 @@ class devector * * **Complexity**: Constant. */ - T* data() BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + T* data() BOOST_NOEXCEPT { return boost::movelib::to_raw_pointer(m_.buffer) + m_.front_idx; } @@ -1336,7 +1364,8 @@ class devector * * **Complexity**: Constant. */ - const T* data() const BOOST_NOEXCEPT + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const T* data() const BOOST_NOEXCEPT { return boost::movelib::to_raw_pointer(m_.buffer) + m_.front_idx; } @@ -1946,22 +1975,28 @@ class devector m_.front_idx = m_.back_idx = 0; } - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const devector& x, const devector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const devector& x, const devector& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const devector& x, const devector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const devector& x, const devector& y) { return !(x == y); } - friend bool operator< (const devector& x, const devector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator< (const devector& x, const devector& y) { return boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const devector& x, const devector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const devector& x, const devector& y) { return y < x; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const devector& x, const devector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const devector& x, const devector& y) { return !(y < x); } - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const devector& x, const devector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const devector& x, const devector& y) { return !(x < y); } BOOST_CONTAINER_FORCEINLINE friend void swap(devector& x, devector& y) @@ -1970,10 +2005,10 @@ class devector private: #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - T* raw_begin() BOOST_NOEXCEPT + BOOST_CONTAINER_FORCEINLINE T* raw_begin() BOOST_NOEXCEPT { return boost::movelib::to_raw_pointer(m_.buffer) + m_.front_idx; } - T* raw_end() BOOST_NOEXCEPT + BOOST_CONTAINER_FORCEINLINE T* raw_end() BOOST_NOEXCEPT { return boost::movelib::to_raw_pointer(m_.buffer) + m_.back_idx; } @@ -2096,12 +2131,12 @@ class devector #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - size_type front_capacity() const + BOOST_CONTAINER_FORCEINLINE size_type front_capacity() const { return m_.back_idx; } - size_type back_capacity() const + BOOST_CONTAINER_FORCEINLINE size_type back_capacity() const { return m_.capacity - m_.front_idx; } diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index 88b32c0..3f69926 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -503,7 +503,8 @@ class flat_map //! was passed to the object's constructor. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.get_allocator()); } //! Effects: Returns a reference to the internal allocator. @@ -513,7 +514,8 @@ class flat_map //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + get_stored_allocator_noconst_return_t get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { impl_get_stored_allocator_noconst_return_t r = m_flat_tree.get_stored_allocator(); return dtl::force(r); @@ -526,7 +528,8 @@ class flat_map //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + get_stored_allocator_const_return_t get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { impl_get_stored_allocator_const_return_t r = m_flat_tree.get_stored_allocator(); return dtl::force(r); @@ -543,7 +546,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.begin()); } //! Effects: Returns a const_iterator to the first element contained in the container. @@ -551,7 +555,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.begin()); } //! Effects: Returns an iterator to the end of the container. @@ -559,7 +564,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.end()); } //! Effects: Returns a const_iterator to the end of the container. @@ -567,7 +573,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.end()); } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -576,7 +583,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rbegin()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -585,7 +593,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rbegin()); } //! Effects: Returns a reverse_iterator pointing to the end @@ -594,7 +603,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rend()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -603,7 +613,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rend()); } //! Effects: Returns a const_iterator to the first element contained in the container. @@ -611,7 +622,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.cbegin()); } //! Effects: Returns a const_iterator to the end of the container. @@ -619,7 +631,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.cend()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -628,7 +641,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.crbegin()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -637,7 +651,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.crend()); } ////////////////////////////////////////////// @@ -651,7 +666,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.empty(); } //! Effects: Returns the number of the elements contained in the container. @@ -659,7 +675,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.size(); } //! Effects: Returns the largest possible size of the container. @@ -667,7 +684,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.max_size(); } //! Effects: Number of elements for which memory has been allocated. @@ -676,7 +694,8 @@ class flat_map //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.capacity(); } //! Effects: If n is less than or equal to capacity(), or the @@ -822,19 +841,23 @@ class flat_map } //! @copydoc ::boost::container::flat_set::nth(size_type) - BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::nth(size_type) const - BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::index_of(iterator) - BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.index_of(dtl::force_copy(p)); } //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const - BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.index_of(dtl::force_copy(p)); } //! Returns: A reference to the element whose key is equivalent to x. @@ -842,7 +865,7 @@ class flat_map //! Throws: An exception object of type out_of_range if no such element is present. //! //! Complexity: logarithmic. - T& at(const key_type& k) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD T& at(const key_type& k) { iterator i = this->find(k); if(i == this->end()){ @@ -856,7 +879,7 @@ class flat_map //! Throws: An exception object of type out_of_range if no such element is present. //! //! Complexity: logarithmic. - const T& at(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD const T& at(const key_type& k) const { const_iterator i = this->find(k); if(i == this->end()){ @@ -1287,14 +1310,16 @@ class flat_map //! of which a was constructed. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + key_compare key_comp() const { return dtl::force_copy(m_flat_tree.key_comp()); } //! Effects: Returns an object of value_compare constructed out //! of the comparison object. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + value_compare value_comp() const { return value_compare(dtl::force_copy(m_flat_tree.key_comp())); } ////////////////////////////////////////////// @@ -1307,14 +1332,16 @@ class flat_map //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator find(const key_type& x) { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator find(const key_type& x) const { return dtl::force_copy(m_flat_tree.find(x)); } //! Requires: This overload is available only if @@ -1325,7 +1352,8 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE iterator find(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator find(const K& x) { return dtl::force_copy(m_flat_tree.find(x)); } //! Requires: This overload is available only if @@ -1336,13 +1364,15 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE const_iterator find(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator find(const K& x) const { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const key_type& x) const { return static_cast(m_flat_tree.find(x) != m_flat_tree.end()); } //! Requires: This overload is available only if @@ -1352,7 +1382,8 @@ class flat_map //! //! Complexity: log(size())+count(k) template - BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const K& x) const //Don't use find() != end optimization here as transparent comparators with key K might //return a different range than key_type (which can only return a single element range) { return m_flat_tree.count(x); } @@ -1361,7 +1392,8 @@ class flat_map //! equivalent to key in the container, otherwise false. //! //! Complexity: log(size()). - bool contains(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool contains(const key_type& x) const { return m_flat_tree.find(x) != m_flat_tree.end(); } //! Requires: This overload is available only if @@ -1372,21 +1404,24 @@ class flat_map //! //! Complexity: log(size()). template - bool contains(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool contains(const K& x) const { return m_flat_tree.find(x) != m_flat_tree.end(); } //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator lower_bound(const key_type& x) { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator lower_bound(const key_type& x) const { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Requires: This overload is available only if @@ -1397,7 +1432,8 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator lower_bound(const K& x) { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Requires: This overload is available only if @@ -1408,21 +1444,24 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator lower_bound(const K& x) const { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: An iterator pointing to the first element with key greater //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator upper_bound(const key_type& x) { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Returns: A const iterator pointing to the first element with key //! greater than x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator upper_bound(const key_type& x) const { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Requires: This overload is available only if @@ -1433,7 +1472,8 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator upper_bound(const K& x) { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Requires: This overload is available only if @@ -1444,19 +1484,22 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator upper_bound(const K& x) const { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& x) { return dtl::force_copy >(m_flat_tree.lower_bound_range(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& x) const { return dtl::force_copy >(m_flat_tree.lower_bound_range(x)); } //! Requires: This overload is available only if @@ -1466,7 +1509,8 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const K& x) //Don't use lower_bound_range optimization here as transparent comparators with key K might //return a different range than key_type (which can only return a single element range) { return dtl::force_copy >(m_flat_tree.equal_range(x)); } @@ -1478,7 +1522,8 @@ class flat_map //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const K& x) const //Don't use lower_bound_range optimization here as transparent comparators with key K might //return a different range than key_type (which can only return a single element range) { return dtl::force_copy >(m_flat_tree.equal_range(x)); } @@ -1490,7 +1535,7 @@ class flat_map //! Postcondition: this->empty() //! //! Throws: If secuence_type's move constructor throws - BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() { return boost::move(dtl::force(m_flat_tree.get_sequence_ref())); } @@ -1519,37 +1564,43 @@ class flat_map //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_map& x, const flat_map& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const flat_map& x, const flat_map& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_map& x, const flat_map& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const flat_map& x, const flat_map& y) { return !(x == y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_map& x, const flat_map& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const flat_map& x, const flat_map& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_map& x, const flat_map& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const flat_map& x, const flat_map& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_map& x, const flat_map& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const flat_map& x, const flat_map& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_map& x, const flat_map& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const flat_map& x, const flat_map& y) { return !(x < y); } //! Effects: x.swap(y) @@ -2095,7 +2146,7 @@ class flat_multimap //! was passed to the object's constructor. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.get_allocator()); } @@ -2106,7 +2157,7 @@ class flat_multimap //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force(m_flat_tree.get_stored_allocator()); } @@ -2117,7 +2168,7 @@ class flat_multimap //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force(m_flat_tree.get_stored_allocator()); } @@ -2132,7 +2183,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.begin()); } @@ -2141,7 +2192,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.begin()); } @@ -2150,7 +2201,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.end()); } @@ -2159,7 +2210,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.end()); } @@ -2169,7 +2220,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rbegin()); } @@ -2179,7 +2230,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rbegin()); } @@ -2189,7 +2240,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rend()); } @@ -2199,7 +2250,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.rend()); } @@ -2208,7 +2259,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.cbegin()); } @@ -2217,7 +2268,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.cend()); } @@ -2227,7 +2278,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.crbegin()); } @@ -2237,7 +2288,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.crend()); } @@ -2252,7 +2303,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.empty(); } @@ -2261,7 +2312,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.size(); } @@ -2270,7 +2321,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.max_size(); } @@ -2280,7 +2331,7 @@ class flat_multimap //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.capacity(); } @@ -2309,22 +2360,22 @@ class flat_multimap { m_flat_tree.shrink_to_fit(); } //! @copydoc ::boost::container::flat_set::nth(size_type) - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::nth(size_type) const - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::index_of(iterator) - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.index_of(dtl::force_copy(p)); } //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const - BOOST_CONTAINER_FORCEINLINE + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { return m_flat_tree.index_of(dtl::force_copy(p)); } @@ -2627,14 +2678,16 @@ class flat_multimap //! of which a was constructed. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + key_compare key_comp() const { return dtl::force_copy(m_flat_tree.key_comp()); } //! Effects: Returns an object of value_compare constructed out //! of the comparison object. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + value_compare value_comp() const { return value_compare(dtl::force_copy(m_flat_tree.key_comp())); } ////////////////////////////////////////////// @@ -2647,14 +2700,16 @@ class flat_multimap //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator find(const key_type& x) { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: An const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator find(const key_type& x) const { return dtl::force_copy(m_flat_tree.find(x)); } //! Requires: This overload is available only if @@ -2665,7 +2720,8 @@ class flat_multimap //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE iterator find(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator find(const K& x) { return dtl::force_copy(m_flat_tree.find(x)); } //! Requires: This overload is available only if @@ -2676,13 +2732,15 @@ class flat_multimap //! //! Complexity: Logarithmic. template - BOOST_CONTAINER_FORCEINLINE const_iterator find(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator find(const K& x) const { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const key_type& x) const { return m_flat_tree.count(x); } //! Requires: This overload is available only if @@ -2692,14 +2750,16 @@ class flat_multimap //! //! Complexity: log(size())+count(k) template - BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const K& x) const { return m_flat_tree.count(x); } //! Returns: Returns true if there is an element with key //! equivalent to key in the container, otherwise false. //! //! Complexity: log(size()). - bool contains(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool contains(const key_type& x) const { return m_flat_tree.find(x) != m_flat_tree.end(); } //! Requires: This overload is available only if @@ -2710,21 +2770,24 @@ class flat_multimap //! //! Complexity: log(size()). template - bool contains(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool contains(const K& x) const { return m_flat_tree.find(x) != m_flat_tree.end(); } //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator lower_bound(const key_type& x) { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator lower_bound(const key_type& x) const { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Requires: This overload is available only if @@ -2735,7 +2798,8 @@ class flat_multimap //! //! Complexity: Logarithmic template - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator lower_bound(const K& x) { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Requires: This overload is available only if @@ -2746,21 +2810,24 @@ class flat_multimap //! //! Complexity: Logarithmic template - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator lower_bound(const K& x) const { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: An iterator pointing to the first element with key greater //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator upper_bound(const key_type& x) {return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Returns: A const iterator pointing to the first element with key //! greater than x, or end() if such an element is not found. //! //! Complexity: Logarithmic - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator upper_bound(const key_type& x) const { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Requires: This overload is available only if @@ -2771,7 +2838,8 @@ class flat_multimap //! //! Complexity: Logarithmic template - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator upper_bound(const K& x) {return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Requires: This overload is available only if @@ -2782,19 +2850,22 @@ class flat_multimap //! //! Complexity: Logarithmic template - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator upper_bound(const K& x) const { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& x) { return dtl::force_copy >(m_flat_tree.equal_range(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const key_type& x) const { return dtl::force_copy >(m_flat_tree.equal_range(x)); } //! Requires: This overload is available only if @@ -2804,7 +2875,8 @@ class flat_multimap //! //! Complexity: Logarithmic template - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const K& x) { return dtl::force_copy >(m_flat_tree.equal_range(x)); } //! Requires: This overload is available only if @@ -2814,7 +2886,8 @@ class flat_multimap //! //! Complexity: Logarithmic template - BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + std::pair equal_range(const K& x) const { return dtl::force_copy >(m_flat_tree.equal_range(x)); } //! Effects: Extracts the internal sequence container. @@ -2824,7 +2897,8 @@ class flat_multimap //! Postcondition: this->empty() //! //! Throws: If secuence_type's move constructor throws - BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + sequence_type extract_sequence() { return boost::move(dtl::force(m_flat_tree.get_sequence_ref())); } @@ -2852,37 +2926,43 @@ class flat_multimap //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_multimap& x, const flat_multimap& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const flat_multimap& x, const flat_multimap& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_multimap& x, const flat_multimap& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const flat_multimap& x, const flat_multimap& y) { return !(x == y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_multimap& x, const flat_multimap& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const flat_multimap& x, const flat_multimap& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_multimap& x, const flat_multimap& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const flat_multimap& x, const flat_multimap& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_multimap& x, const flat_multimap& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const flat_multimap& x, const flat_multimap& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_multimap& x, const flat_multimap& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const flat_multimap& x, const flat_multimap& y) { return !(x < y); } //! Effects: x.swap(y) diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index 2c25f4a..33270cf 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -488,7 +488,8 @@ class list //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_type(this->node_alloc()); } //! Effects: Returns a reference to the internal allocator. @@ -498,7 +499,8 @@ class list //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return this->node_alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -508,7 +510,8 @@ class list //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->node_alloc(); } ////////////////////////////////////////////// @@ -522,7 +525,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->icont().begin()); } //! Effects: Returns a const_iterator to the first element contained in the list. @@ -530,7 +534,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->cbegin(); } //! Effects: Returns an iterator to the end of the list. @@ -538,7 +543,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->icont().end()); } //! Effects: Returns a const_iterator to the end of the list. @@ -546,7 +552,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return this->cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -555,7 +562,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -564,7 +572,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end @@ -573,7 +582,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -582,7 +592,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->crend(); } //! Effects: Returns a const_iterator to the first element contained in the list. @@ -590,7 +601,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->non_const_icont().begin()); } //! Effects: Returns a const_iterator to the end of the list. @@ -598,7 +610,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->non_const_icont().end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -607,7 +620,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->cend()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -616,7 +630,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->cbegin()); } ////////////////////////////////////////////// @@ -630,7 +645,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return !this->size(); } //! Effects: Returns the number of the elements contained in the list. @@ -638,7 +654,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { return this->icont().size(); } //! Effects: Returns the largest possible size of the list. @@ -646,7 +663,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return AllocHolder::max_size(); } //! Effects: Inserts or erases elements at the end such that @@ -690,7 +708,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->begin(); @@ -704,7 +723,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->begin(); @@ -718,7 +738,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(--this->end()); @@ -732,7 +753,8 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(--this->end()); @@ -1374,43 +1396,49 @@ class list //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - friend bool operator==(const list& x, const list& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const list& x, const list& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - friend bool operator!=(const list& x, const list& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const list& x, const list& y) { return !(x == y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator<(const list& x, const list& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const list& x, const list& y) { return boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator>(const list& x, const list& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const list& x, const list& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator<=(const list& x, const list& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const list& x, const list& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator>=(const list& x, const list& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const list& x, const list& y) { return !(x < y); } //! Effects: x.swap(y) //! //! Complexity: Constant. - friend void swap(list& x, list& y) + BOOST_CONTAINER_FORCEINLINE friend void swap(list& x, list& y) { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index 477dcc1..84270e9 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -664,7 +664,7 @@ class map //! Returns: A reference to the element whose key is equivalent to x. //! Throws: An exception object of type out_of_range if no such element is present. //! Complexity: logarithmic. - const T& at(const key_type& k) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD const T& at(const key_type& k) const { const_iterator i = this->find(k); if(i == this->end()){ @@ -1120,7 +1120,8 @@ class map //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const key_type& x) const { return static_cast(this->find(x) != this->cend()); } //! Requires: This overload is available only if @@ -1130,7 +1131,8 @@ class map //! //! Complexity: log(size())+count(k) template - BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const K& x) const { return static_cast(this->find(x) != this->cend()); } #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index b216c01..14b5b6b 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -774,7 +774,8 @@ class set //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const key_type& x) const { return static_cast(this->base_t::find(x) != this->base_t::cend()); } //! Requires: This overload is available only if @@ -784,7 +785,8 @@ class set //! //! Complexity: log(size())+count(k) template - BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type count(const K& x) const { return static_cast(this->find(x) != this->cend()); } #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index d10cf57..d142744 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -521,7 +521,8 @@ class slist //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return allocator_type(this->node_alloc()); } //! Effects: Returns a reference to the internal allocator. @@ -531,7 +532,8 @@ class slist //! Complexity: Constant. //! //! Note: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return this->node_alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -541,7 +543,8 @@ class slist //! Complexity: Constant. //! //! Note: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->node_alloc(); } ////////////////////////////////////////////// @@ -557,7 +560,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - iterator before_begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator before_begin() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(end()); } //! Effects: Returns a non-dereferenceable const_iterator @@ -567,7 +571,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator before_begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator before_begin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->cbefore_begin(); } //! Effects: Returns an iterator to the first element contained in the list. @@ -575,7 +580,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->icont().begin()); } //! Effects: Returns a const_iterator to the first element contained in the list. @@ -583,7 +589,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->cbegin(); } //! Effects: Returns an iterator to the end of the list. @@ -591,7 +598,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->icont().end()); } //! Effects: Returns a const_iterator to the end of the list. @@ -599,7 +607,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return this->cend(); } //! Effects: Returns a non-dereferenceable const_iterator @@ -609,7 +618,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbefore_begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbefore_begin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(end()); } //! Effects: Returns a const_iterator to the first element contained in the list. @@ -617,7 +627,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->non_const_icont().begin()); } //! Effects: Returns a const_iterator to the end of the list. @@ -625,7 +636,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->non_const_icont().end()); } //! Returns: The iterator to the element before i in the sequence. @@ -637,7 +649,8 @@ class slist //! Complexity: Linear to the number of elements before i. //! //! Note: Non-standard extension. - iterator previous(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator previous(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->icont().previous(p.get())); } //! Returns: The const_iterator to the element before i in the sequence. @@ -649,7 +662,8 @@ class slist //! Complexity: Linear to the number of elements before i. //! //! Note: Non-standard extension. - const_iterator previous(const_iterator p) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator previous(const_iterator p) { return const_iterator(this->icont().previous(p.get())); } ////////////////////////////////////////////// @@ -663,7 +677,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - bool empty() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const { return !this->size(); } //! Effects: Returns the number of the elements contained in the list. @@ -671,7 +686,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - size_type size() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const { return this->icont().size(); } //! Effects: Returns the largest possible size of the list. @@ -679,7 +695,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - size_type max_size() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const { return AllocHolder::max_size(); } //! Effects: Inserts or erases elements at the end such that @@ -725,7 +742,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - reference front() + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference front() { BOOST_ASSERT(!this->empty()); return *this->begin(); @@ -739,7 +757,8 @@ class slist //! Throws: Nothing. //! //! Complexity: Constant. - const_reference front() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference front() const { BOOST_ASSERT(!this->empty()); return *this->begin(); @@ -1574,31 +1593,36 @@ class slist //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - friend bool operator!=(const slist& x, const slist& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const slist& x, const slist& y) { return !(x == y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator<(const slist& x, const slist& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const slist& x, const slist& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator>(const slist& x, const slist& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const slist& x, const slist& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator<=(const slist& x, const slist& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const slist& x, const slist& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator>=(const slist& x, const slist& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const slist& x, const slist& y) { return !(x < y); } //! Effects: x.swap(y) diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 482c0cf..b5906bd 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -344,15 +344,18 @@ class stable_vector_iterator BOOST_CONTAINER_FORCEINLINE stable_vector_iterator & operator=(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW { m_pn = other.node_pointer(); return *this; } - BOOST_CONTAINER_FORCEINLINE node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW { return node_ptr_traits::static_cast_from(m_pn); } public: //Pointer like operators - BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW { return node_pointer()->get_data(); } - BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW { return ptr_traits::pointer_to(this->operator*()); } //Increment / Decrement @@ -376,7 +379,8 @@ class stable_vector_iterator BOOST_CONTAINER_FORCEINLINE stable_vector_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW { stable_vector_iterator tmp(*this); --*this; return stable_vector_iterator(tmp); } - BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW { return node_ptr_traits::static_cast_from(this->m_pn->up[off])->get_data(); } BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW @@ -385,14 +389,16 @@ class stable_vector_iterator return *this; } - BOOST_CONTAINER_FORCEINLINE friend stable_vector_iterator operator+(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend stable_vector_iterator operator+(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { stable_vector_iterator tmp(left); tmp += off; return tmp; } - BOOST_CONTAINER_FORCEINLINE friend stable_vector_iterator operator+(difference_type off, const stable_vector_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend stable_vector_iterator operator+(difference_type off, const stable_vector_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW { stable_vector_iterator tmp(right); tmp += off; @@ -402,33 +408,41 @@ class stable_vector_iterator BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { *this += -off; return *this; } - BOOST_CONTAINER_FORCEINLINE friend stable_vector_iterator operator-(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend stable_vector_iterator operator-(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { stable_vector_iterator tmp(left); tmp -= off; return tmp; } - BOOST_CONTAINER_FORCEINLINE friend difference_type operator-(const stable_vector_iterator &left, const stable_vector_iterator &right) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend difference_type operator-(const stable_vector_iterator &left, const stable_vector_iterator &right) BOOST_NOEXCEPT_OR_NOTHROW { return left.m_pn->up - right.m_pn->up; } //Comparison operators - BOOST_CONTAINER_FORCEINLINE friend bool operator== (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator== (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_pn == r.m_pn; } - BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_pn != r.m_pn; } - BOOST_CONTAINER_FORCEINLINE friend bool operator< (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator< (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_pn->up < r.m_pn->up; } - BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_pn->up <= r.m_pn->up; } - BOOST_CONTAINER_FORCEINLINE friend bool operator> (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator> (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_pn->up > r.m_pn->up; } - BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return l.m_pn->up >= r.m_pn->up; } }; @@ -951,7 +965,8 @@ class stable_vector //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const { return this->priv_node_alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -961,7 +976,8 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_node_alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -971,7 +987,8 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_node_alloc(); } ////////////////////////////////////////////// @@ -985,7 +1002,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return (this->index.empty()) ? this->end(): iterator(node_ptr_traits::static_cast_from(this->index.front())); } //! Effects: Returns a const_iterator to the first element contained in the stable_vector. @@ -993,7 +1011,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return (this->index.empty()) ? this->cend() : const_iterator(node_ptr_traits::static_cast_from(this->index.front())) ; } //! Effects: Returns an iterator to the end of the stable_vector. @@ -1001,7 +1020,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return iterator(this->priv_get_end_node()); } //! Effects: Returns a const_iterator to the end of the stable_vector. @@ -1009,7 +1029,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return const_iterator(this->priv_get_end_node()); } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -1018,7 +1039,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->end()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1027,7 +1049,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->end()); } //! Effects: Returns a reverse_iterator pointing to the end @@ -1036,7 +1059,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->begin()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1045,7 +1069,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->begin()); } //! Effects: Returns a const_iterator to the first element contained in the stable_vector. @@ -1053,7 +1078,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->begin(); } //! Effects: Returns a const_iterator to the end of the stable_vector. @@ -1061,7 +1087,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->end(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1070,7 +1097,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->rbegin(); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1079,7 +1107,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW { return this->rend(); } ////////////////////////////////////////////// @@ -1093,7 +1122,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return this->index.size() <= ExtraPointers; } //! Effects: Returns the number of the elements contained in the stable_vector. @@ -1101,7 +1131,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { const size_type index_size = this->index.size(); return (index_size - ExtraPointers) & (size_type(0u) -size_type(index_size != 0)); @@ -1112,7 +1143,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return this->index.max_size() - ExtraPointers; } //! Effects: Inserts or erases elements at the end such that @@ -1170,7 +1202,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { const size_type index_size = this->index.size(); BOOST_ASSERT(!index_size || index_size >= ExtraPointers); @@ -1257,7 +1290,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index.front()).get_data(); @@ -1271,7 +1305,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index.front()).get_data(); @@ -1285,7 +1320,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index[this->size()-1u]).get_data(); @@ -1299,7 +1335,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index[this->size()-1u]).get_data(); @@ -1313,7 +1350,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() > n); return static_cast(*this->index[n]).get_data(); @@ -1327,7 +1365,8 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() > n); return static_cast(*this->index[n]).get_data(); @@ -1344,7 +1383,8 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() >= n); return (this->index.empty()) ? this->end() : iterator(node_ptr_traits::static_cast_from(this->index[n])); @@ -1361,7 +1401,8 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() >= n); return (this->index.empty()) ? this->cend() : iterator(node_ptr_traits::static_cast_from(this->index[n])); @@ -1377,7 +1418,8 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_index_of(p.node_pointer()); } //! Requires: begin() <= p <= end(). @@ -1390,7 +1432,8 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_index_of(p.node_pointer()); } //! Requires: size() > n. @@ -1401,7 +1444,8 @@ class stable_vector //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - reference at(size_type n) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference at(size_type n) { if(n >= this->size()){ throw_out_of_range("vector::at invalid subscript"); @@ -1417,7 +1461,8 @@ class stable_vector //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - const_reference at(size_type n)const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference at(size_type n)const { if(n >= this->size()){ throw_out_of_range("vector::at invalid subscript"); @@ -1752,37 +1797,43 @@ class stable_vector //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator==(const stable_vector& x, const stable_vector& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator!=(const stable_vector& x, const stable_vector& y) { return !(x == y); } //! Effects: Returns true if x is less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<(const stable_vector& x, const stable_vector& y) { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>(const stable_vector& x, const stable_vector& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator<=(const stable_vector& x, const stable_vector& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + friend bool operator>=(const stable_vector& x, const stable_vector& y) { return !(x < y); } //! Effects: x.swap(y) diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 516b701..bd1381b 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -951,7 +951,8 @@ class basic_string //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -961,7 +962,8 @@ class basic_string //! Complexity: Constant. //! //! Note: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return this->alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -971,7 +973,8 @@ class basic_string //! Complexity: Constant. //! //! Note: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return this->alloc(); } ////////////////////////////////////////////// @@ -985,7 +988,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator begin() BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_addr(); } //! Effects: Returns a const_iterator to the first element contained in the vector. @@ -993,7 +997,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_addr(); } //! Effects: Returns an iterator to the end of the vector. @@ -1001,7 +1006,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + iterator end() BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_end_addr(); } //! Effects: Returns a const_iterator to the end of the vector. @@ -1009,7 +1015,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_end_addr(); } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -1018,7 +1025,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->priv_end_addr()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1027,7 +1035,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end @@ -1036,7 +1045,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW { return reverse_iterator(this->priv_addr()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1045,7 +1055,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->crend(); } //! Effects: Returns a const_iterator to the first element contained in the vector. @@ -1053,7 +1064,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_addr(); } //! Effects: Returns a const_iterator to the end of the vector. @@ -1061,7 +1073,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_end_addr(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1070,7 +1083,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->priv_end_addr()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -1079,7 +1093,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->priv_addr()); } ////////////////////////////////////////////// @@ -1093,7 +1108,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + bool empty() const BOOST_NOEXCEPT_OR_NOTHROW { return !this->priv_size(); } //! Effects: Returns the number of the elements contained in the vector. @@ -1101,7 +1117,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type size() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_size(); } //! Effects: Returns the number of the elements contained in the vector. @@ -1109,15 +1126,17 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - size_type length() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type length() const BOOST_NOEXCEPT_OR_NOTHROW { return this->size(); } //! Effects: Returns the largest possible size of the vector. //! //! Throws: Nothing. //! - //! Complexity: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + //! Complexity: Constant + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return base_t::max_size(); } //! Effects: Inserts or erases elements at the end such that @@ -1143,7 +1162,6 @@ class basic_string void resize(size_type n) { resize(n, CharT()); } - //! Effects: Inserts or erases elements at the end such that //! the size becomes n. New elements are uninitialized. //! @@ -1169,7 +1187,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_capacity(); } //! Effects: If n is less than or equal to capacity(), this call has no @@ -1228,7 +1247,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->priv_addr(); @@ -1242,7 +1262,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->priv_addr(); @@ -1256,7 +1277,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(this->priv_addr() + (this->size() - 1u) ); @@ -1270,7 +1292,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(this->priv_addr() + (this->size() - 1u) ); @@ -1284,7 +1307,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() > n); return *(this->priv_addr() + n); @@ -1298,7 +1322,8 @@ class basic_string //! Throws: Nothing. //! //! Complexity: Constant. - const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() > n); return *(this->priv_addr() + n); @@ -1312,7 +1337,8 @@ class basic_string //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - reference at(size_type n) + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + reference at(size_type n) { if (n >= this->size()) throw_out_of_range("basic_string::at invalid subscript"); @@ -1327,7 +1353,8 @@ class basic_string //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - const_reference at(size_type n) const { + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const_reference at(size_type n) const { if (n >= this->size()) throw_out_of_range("basic_string::at invalid subscript"); return *(this->priv_addr() + n); @@ -2237,7 +2264,8 @@ class basic_string //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()]. //! //! Complexity: constant time. - const CharT* c_str() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const CharT* c_str() const BOOST_NOEXCEPT_OR_NOTHROW { return boost::movelib::to_raw_pointer(this->priv_addr()); } //! Requires: The program shall not alter any of the values stored in the character array. @@ -2245,13 +2273,15 @@ class basic_string //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()]. //! //! Complexity: constant time. - const CharT* data() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + const CharT* data() const BOOST_NOEXCEPT_OR_NOTHROW { return boost::movelib::to_raw_pointer(this->priv_addr()); } //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()]. //! //! Complexity: constant time. - CharT* data() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + CharT* data() BOOST_NOEXCEPT_OR_NOTHROW { return boost::movelib::to_raw_pointer(this->priv_addr()); } #ifndef BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN @@ -2270,7 +2300,8 @@ class basic_string //! Note: This function is available to write portable code for compilers //! that don't support templated conversion operators. template - BasicStringView to_view() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + BasicStringView to_view() const BOOST_NOEXCEPT_OR_NOTHROW { return BasicStringView(this->data(), this->size()); } ////////////////////////////////////////////// @@ -2287,7 +2318,8 @@ class basic_string //! Throws: Nothing //! //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos. - size_type find(const basic_string& s, size_type pos = 0) const + BOOST_CONTAINER_ATTRIBUTE_NODISCARD BOOST_CONTAINER_FORCEINLINE + size_type find(const basic_string& s, size_type pos = 0) const { return find(s.c_str(), pos, s.size()); } //! Effects: Determines the lowest position xpos, if possible, such that both @@ -2299,7 +2331,8 @@ class basic_string //! //! Returns: xpos if the function can determine such a value for xpos. Otherwise, returns npos. template