From 2b3775985e1909ee6ffc6a9b5a0c67bee32e51bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 5 Mar 2019 12:11:43 +0100 Subject: [PATCH] Add BOOST_CONTAINER_FORCEINLINE --- include/boost/container/allocator.hpp | 14 +- include/boost/container/deque.hpp | 208 ++++++++--------- include/boost/container/detail/iterators.hpp | 230 +++++++++---------- include/boost/container/list.hpp | 26 +-- include/boost/container/stable_vector.hpp | 170 +++++++------- 5 files changed, 324 insertions(+), 324 deletions(-) diff --git a/include/boost/container/allocator.hpp b/include/boost/container/allocator.hpp index 2a21aff..aef620c 100644 --- a/include/boost/container/allocator.hpp +++ b/include/boost/container/allocator.hpp @@ -190,17 +190,17 @@ class allocator //!Deallocates previously allocated memory. //!Never throws - void deallocate(pointer ptr, size_type) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void deallocate(pointer ptr, size_type) BOOST_NOEXCEPT_OR_NOTHROW { dlmalloc_free(ptr); } //!Returns the maximum number of elements that could be allocated. //!Never throws - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return size_type(-1)/sizeof(T); } //!Swaps two allocators, does nothing //!because this allocator is stateless - friend void swap(self_t &, self_t &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend void swap(self_t &, self_t &) BOOST_NOEXCEPT_OR_NOTHROW {} //!An allocator always compares to true, as memory allocated with one @@ -210,7 +210,7 @@ class allocator //!An allocator always compares to false, 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_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 @@ -246,7 +246,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 - pointer allocate_one() + BOOST_CONTAINER_FORCEINLINE pointer allocate_one() { BOOST_STATIC_ASSERT(( Version > 1 )); return this->allocate(1); @@ -255,7 +255,7 @@ class allocator //!Allocates many elements of size == 1. //!Elements must be individually deallocated with deallocate_one() //!This function is available only with Version == 2 - void allocate_individual(std::size_t num_elements, multiallocation_chain &chain) + BOOST_CONTAINER_FORCEINLINE void allocate_individual(std::size_t num_elements, multiallocation_chain &chain) { BOOST_STATIC_ASSERT(( Version > 1 )); this->allocate_many(1, num_elements, chain); @@ -273,7 +273,7 @@ class allocator //!Deallocates memory allocated with allocate_one() or allocate_individual(). //!This function is available only with Version == 2 - 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/deque.hpp b/include/boost/container/deque.hpp index 7de127a..eb120cd 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -141,16 +141,16 @@ class deque_iterator public: - Pointer get_cur() const { return m_cur; } - Pointer get_first() const { return m_first; } - Pointer get_last() const { return m_last; } - index_pointer get_node() const { return m_node; } + 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; } - deque_iterator(val_alloc_ptr x, index_pointer y) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque_iterator(val_alloc_ptr x, index_pointer y) BOOST_NOEXCEPT_OR_NOTHROW : m_cur(x), m_first(*y), m_last(*y + s_buffer_size()), m_node(y) {} - deque_iterator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque_iterator() BOOST_NOEXCEPT_OR_NOTHROW : m_cur(), m_first(), m_last(), m_node() //Value initialization to achieve "null iterators" (N3644) {} @@ -167,10 +167,10 @@ class deque_iterator return deque_iterator(this->get_cur(), this->get_first(), this->get_last(), this->get_node()); } - reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW { return *this->m_cur; } - pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -192,7 +192,7 @@ class deque_iterator return *this; } - deque_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW { deque_iterator tmp(*this); ++*this; @@ -209,7 +209,7 @@ class deque_iterator return *this; } - deque_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW { deque_iterator tmp(*this); --*this; @@ -232,44 +232,44 @@ class deque_iterator return *this; } - deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW { deque_iterator tmp(*this); return tmp += n; } - 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; } - deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW { deque_iterator tmp(*this); return tmp -= n; } - reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW { return *(*this + n); } - friend bool operator==(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator!=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator<(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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); } - friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return r < l; } - friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return !(r < l); } - friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW { return !(l < r); } - void priv_set_node(index_pointer new_node) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void priv_set_node(index_pointer new_node) BOOST_NOEXCEPT_OR_NOTHROW { this->m_node = new_node; this->m_first = *new_node; this->m_last = this->m_first + this->s_buffer_size(); } - friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW { return x += n; } }; @@ -308,37 +308,37 @@ class deque_base typedef deque_value_traits traits_t; typedef ptr_alloc_t map_allocator_type; - static size_type s_buffer_size() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type s_buffer_size() BOOST_NOEXCEPT_OR_NOTHROW { return deque_buf_size::value; } - val_alloc_ptr priv_allocate_node() + BOOST_CONTAINER_FORCEINLINE val_alloc_ptr priv_allocate_node() { return this->alloc().allocate(s_buffer_size()); } - void priv_deallocate_node(val_alloc_ptr p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void priv_deallocate_node(val_alloc_ptr p) BOOST_NOEXCEPT_OR_NOTHROW { this->alloc().deallocate(p, s_buffer_size()); } - ptr_alloc_ptr priv_allocate_map(size_type n) + BOOST_CONTAINER_FORCEINLINE ptr_alloc_ptr priv_allocate_map(size_type n) { return this->ptr_alloc().allocate(n); } - void priv_deallocate_map(ptr_alloc_ptr p, size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void priv_deallocate_map(ptr_alloc_ptr p, size_type n) BOOST_NOEXCEPT_OR_NOTHROW { this->ptr_alloc().deallocate(p, n); } typedef dtl::deque_iterator iterator; typedef dtl::deque_iterator const_iterator; - deque_base(size_type num_elements, const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE deque_base(size_type num_elements, const allocator_type& a) : members_(a) { this->priv_initialize_map(num_elements); } - explicit deque_base(const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE explicit deque_base(const allocator_type& a) : members_(a) {} - deque_base() + BOOST_CONTAINER_FORCEINLINE deque_base() : members_() {} - explicit deque_base(BOOST_RV_REF(deque_base) x) + BOOST_CONTAINER_FORCEINLINE explicit deque_base(BOOST_RV_REF(deque_base) x) : members_( boost::move(x.ptr_alloc()) , boost::move(x.alloc()) ) {} @@ -459,16 +459,16 @@ class deque_base iterator m_finish; } members_; - ptr_alloc_t &ptr_alloc() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE ptr_alloc_t &ptr_alloc() BOOST_NOEXCEPT_OR_NOTHROW { return members_; } - const ptr_alloc_t &ptr_alloc() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const ptr_alloc_t &ptr_alloc() const BOOST_NOEXCEPT_OR_NOTHROW { return members_; } - allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW { return members_; } - const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW { return members_; } }; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -518,7 +518,7 @@ class deque : protected deque_base::type> private: // Internal typedefs BOOST_COPYABLE_AND_MOVABLE(deque) typedef typename Base::ptr_alloc_ptr index_pointer; - static size_type s_buffer_size() + BOOST_CONTAINER_FORCEINLINE static size_type s_buffer_size() { return Base::s_buffer_size(); } typedef allocator_traits allocator_traits_type; @@ -536,7 +536,7 @@ class deque : protected deque_base::type> //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - deque() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) + BOOST_CONTAINER_FORCEINLINE deque() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : Base() {} @@ -545,7 +545,7 @@ class deque : protected deque_base::type> //! Throws: Nothing //! //! Complexity: Constant. - explicit deque(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE explicit deque(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW : Base(a) {} @@ -556,7 +556,7 @@ class deque : protected deque_base::type> //! throws or T's value initialization throws. //! //! Complexity: Linear to n. - explicit deque(size_type n) + BOOST_CONTAINER_FORCEINLINE explicit deque(size_type n) : Base(n, allocator_type()) { dtl::insert_value_initialized_n_proxy proxy; @@ -573,7 +573,7 @@ class deque : protected deque_base::type> //! Complexity: Linear to n. //! //! Note: Non-standard extension - deque(size_type n, default_init_t) + BOOST_CONTAINER_FORCEINLINE deque(size_type n, default_init_t) : Base(n, allocator_type()) { dtl::insert_default_initialized_n_proxy proxy; @@ -588,7 +588,7 @@ class deque : protected deque_base::type> //! throws or T's value initialization throws. //! //! Complexity: Linear to n. - explicit deque(size_type n, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE explicit deque(size_type n, const allocator_type &a) : Base(n, a) { dtl::insert_value_initialized_n_proxy proxy; @@ -605,7 +605,7 @@ class deque : protected deque_base::type> //! Complexity: Linear to n. //! //! Note: Non-standard extension - deque(size_type n, default_init_t, const allocator_type &a) + BOOST_CONTAINER_FORCEINLINE deque(size_type n, default_init_t, const allocator_type &a) : Base(n, a) { dtl::insert_default_initialized_n_proxy proxy; @@ -620,7 +620,7 @@ class deque : protected deque_base::type> //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. - deque(size_type n, const value_type& value) + BOOST_CONTAINER_FORCEINLINE deque(size_type n, const value_type& value) : Base(n, allocator_type()) { this->priv_fill_initialize(value); } @@ -631,7 +631,7 @@ class deque : protected deque_base::type> //! throws or T's copy constructor throws. //! //! Complexity: Linear to n. - deque(size_type n, const value_type& value, const allocator_type& a) + BOOST_CONTAINER_FORCEINLINE deque(size_type n, const value_type& value, const allocator_type& a) : Base(n, a) { this->priv_fill_initialize(value); } @@ -643,7 +643,7 @@ class deque : protected deque_base::type> //! //! Complexity: Linear to the range [first, last). template - deque(InIt first, InIt last + BOOST_CONTAINER_FORCEINLINE deque(InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_convertible ::type * = 0 @@ -662,7 +662,7 @@ class deque : protected deque_base::type> //! //! Complexity: Linear to the range [first, last). template - deque(InIt first, InIt last, const allocator_type& a + BOOST_CONTAINER_FORCEINLINE deque(InIt first, InIt last, const allocator_type& a #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_convertible ::type * = 0 @@ -681,7 +681,7 @@ class deque : protected deque_base::type> //! throws or T's constructor taking a dereferenced std::initializer_list iterator throws. //! //! Complexity: Linear to the range [il.begin(), il.end()). - deque(std::initializer_list il, const allocator_type& a = allocator_type()) + BOOST_CONTAINER_FORCEINLINE deque(std::initializer_list il, const allocator_type& a = allocator_type()) : Base(a) { this->priv_range_initialize(il.begin(), il.end()); @@ -693,7 +693,7 @@ class deque : protected deque_base::type> //! Postcondition: x == *this. //! //! Complexity: Linear to the elements x contains. - deque(const deque& x) + BOOST_CONTAINER_FORCEINLINE deque(const deque& x) : Base(allocator_traits_type::select_on_container_copy_construction(x.alloc())) { if(x.size()){ @@ -708,7 +708,7 @@ class deque : protected deque_base::type> //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - deque(BOOST_RV_REF(deque) x) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE deque(BOOST_RV_REF(deque) x) BOOST_NOEXCEPT_OR_NOTHROW : Base(BOOST_MOVE_BASE(Base, x)) { this->swap_members(x); } @@ -759,7 +759,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Linear to the number of elements. - ~deque() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE ~deque() BOOST_NOEXCEPT_OR_NOTHROW { this->priv_destroy_range(this->members_.m_start, this->members_.m_finish); } @@ -837,7 +837,7 @@ class deque : protected deque_base::type> //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in il. - deque& operator=(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE deque& operator=(std::initializer_list il) { this->assign(il.begin(), il.end()); return *this; @@ -849,7 +849,7 @@ class deque : protected deque_base::type> //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. - void assign(size_type n, const T& val) + BOOST_CONTAINER_FORCEINLINE void assign(size_type n, const T& val) { typedef constant_iterator c_it; this->assign(c_it(val, n), c_it()); @@ -914,7 +914,7 @@ class deque : protected deque_base::type> //! T's constructor from dereferencing std::initializer_list iterator throws. //! //! Complexity: Linear to il.size(). - void assign(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list il) { this->assign(il.begin(), il.end()); } #endif @@ -923,7 +923,7 @@ class deque : protected deque_base::type> //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return Base::alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -933,7 +933,7 @@ class deque : protected deque_base::type> //! Complexity: Constant. //! //! Note: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return Base::alloc(); } ////////////////////////////////////////////// @@ -949,7 +949,7 @@ class deque : protected deque_base::type> //! Complexity: Constant. //! //! Note: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -957,7 +957,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -965,7 +965,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -973,7 +973,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -981,7 +981,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -990,7 +990,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -999,7 +999,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1008,7 +1008,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1017,7 +1017,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1025,7 +1025,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1033,7 +1033,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1042,7 +1042,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1051,7 +1051,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW { return const_reverse_iterator(this->members_.m_start); } ////////////////////////////////////////////// @@ -1065,7 +1065,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1073,7 +1073,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1081,7 +1081,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1168,7 +1168,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->members_.m_start; @@ -1182,7 +1182,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *this->members_.m_start; @@ -1196,7 +1196,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(end()-1); @@ -1210,7 +1210,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return *(cend()-1); @@ -1224,7 +1224,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW + 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)]; @@ -1238,7 +1238,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + 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)]; @@ -1255,7 +1255,7 @@ class deque : protected deque_base::type> //! Complexity: Constant. //! //! Note: Non-standard extension - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->size() >= n); return iterator(this->begin()+n); @@ -1272,7 +1272,7 @@ class deque : protected deque_base::type> //! Complexity: Constant. //! //! Note: Non-standard extension - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + 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); @@ -1288,7 +1288,7 @@ class deque : protected deque_base::type> //! Complexity: Constant. //! //! Note: Non-standard extension - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { //Range checked priv_index_of return this->priv_index_of(p); @@ -1304,7 +1304,7 @@ class deque : protected deque_base::type> //! Complexity: Constant. //! //! Note: Non-standard extension - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + 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); @@ -1318,7 +1318,7 @@ class deque : protected deque_base::type> //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - reference at(size_type n) + BOOST_CONTAINER_FORCEINLINE reference at(size_type n) { this->priv_throw_if_out_of_range(n); return (*this)[n]; @@ -1332,7 +1332,7 @@ class deque : protected deque_base::type> //! Throws: std::range_error if n >= size() //! //! Complexity: Constant. - const_reference at(size_type n) const + BOOST_CONTAINER_FORCEINLINE const_reference at(size_type n) const { this->priv_throw_if_out_of_range(n); return (*this)[n]; @@ -1564,7 +1564,7 @@ class deque : protected deque_base::type> //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. - iterator insert(const_iterator pos, size_type n, const value_type& x) + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator pos, size_type n, const value_type& x) { //Range check of p is done by insert() typedef constant_iterator c_it; @@ -1614,7 +1614,7 @@ class deque : protected deque_base::type> //! dereferenced std::initializer_list throws or T's copy constructor throws. //! //! Complexity: Linear to distance [il.begin(), il.end()). - iterator insert(const_iterator pos, std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator pos, std::initializer_list il) { //Range check os pos is done in insert() return insert(pos, il.begin(), il.end()); @@ -1623,7 +1623,7 @@ class deque : protected deque_base::type> #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template - iterator insert(const_iterator p, FwdIt first, FwdIt last + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, FwdIt first, FwdIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) , typename dtl::disable_if_or < void @@ -1744,7 +1744,7 @@ class deque : protected deque_base::type> //! Throws: Nothing. //! //! Complexity: Constant. - void swap(deque &x) + BOOST_CONTAINER_FORCEINLINE void swap(deque &x) BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_swap::value || allocator_traits_type::is_always_equal::value) { @@ -1782,49 +1782,49 @@ 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. - friend bool operator==(const deque& x, const deque& y) + 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. - friend bool operator!=(const deque& x, const deque& y) + 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. - friend bool operator<(const deque& x, const deque& y) + 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. - friend bool operator>(const deque& x, const deque& y) + 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. - friend bool operator<=(const deque& x, const deque& y) + 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. - friend bool operator>=(const deque& x, const deque& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const deque& x, const deque& y) { return !(x < y); } //! Effects: x.swap(y) //! //! Complexity: Constant. - friend void swap(deque& x, deque& y) + BOOST_CONTAINER_FORCEINLINE friend void swap(deque& x, deque& y) { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: - size_type priv_index_of(const_iterator p) const + BOOST_CONTAINER_FORCEINLINE size_type priv_index_of(const_iterator p) const { BOOST_ASSERT(this->cbegin() <= p); BOOST_ASSERT(p <= this->cend()); @@ -1850,12 +1850,12 @@ class deque : protected deque_base::type> throw_out_of_range("deque::at out of range"); } - bool priv_in_range(const_iterator pos) const + BOOST_CONTAINER_FORCEINLINE bool priv_in_range(const_iterator pos) const { return (this->begin() <= pos) && (pos < this->end()); } - bool priv_in_range_or_end(const_iterator pos) const + BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const { return (this->begin() <= pos) && (pos <= this->end()); } @@ -1909,32 +1909,32 @@ class deque : protected deque_base::type> } } - bool priv_push_back_simple_available() const + BOOST_CONTAINER_FORCEINLINE bool priv_push_back_simple_available() const { return this->members_.m_map && (this->members_.m_finish.m_cur != (this->members_.m_finish.m_last - 1)); } - T *priv_push_back_simple_pos() const + BOOST_CONTAINER_FORCEINLINE T *priv_push_back_simple_pos() const { return boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur); } - void priv_push_back_simple_commit() + BOOST_CONTAINER_FORCEINLINE void priv_push_back_simple_commit() { ++this->members_.m_finish.m_cur; } - bool priv_push_front_simple_available() const + BOOST_CONTAINER_FORCEINLINE bool priv_push_front_simple_available() const { return this->members_.m_map && (this->members_.m_start.m_cur != this->members_.m_start.m_first); } - T *priv_push_front_simple_pos() const + BOOST_CONTAINER_FORCEINLINE T *priv_push_front_simple_pos() const { return boost::movelib::to_raw_pointer(this->members_.m_start.m_cur) - 1; } - void priv_push_front_simple_commit() + BOOST_CONTAINER_FORCEINLINE void priv_push_front_simple_commit() { --this->members_.m_start.m_cur; } void priv_destroy_range(iterator p, iterator p2) @@ -2061,7 +2061,7 @@ class deque : protected deque_base::type> return new_start; } - iterator priv_fill_insert(const_iterator pos, size_type n, const value_type& x) + BOOST_CONTAINER_FORCEINLINE iterator priv_fill_insert(const_iterator pos, size_type n, const value_type& x) { typedef constant_iterator c_it; return this->insert(pos, c_it(x, n), c_it()); diff --git a/include/boost/container/detail/iterators.hpp b/include/boost/container/detail/iterators.hpp index 7ccdac9..ad98b11 100644 --- a/include/boost/container/detail/iterators.hpp +++ b/include/boost/container/detail/iterators.hpp @@ -49,106 +49,106 @@ class constant_iterator typedef constant_iterator this_type; public: - explicit constant_iterator(const T &ref, Difference range_size) + BOOST_CONTAINER_FORCEINLINE explicit constant_iterator(const T &ref, Difference range_size) : m_ptr(&ref), m_num(range_size){} //Constructors - constant_iterator() + BOOST_CONTAINER_FORCEINLINE constant_iterator() : m_ptr(0), m_num(0){} - constant_iterator& operator++() + BOOST_CONTAINER_FORCEINLINE constant_iterator& operator++() { increment(); return *this; } - constant_iterator operator++(int) + BOOST_CONTAINER_FORCEINLINE constant_iterator operator++(int) { constant_iterator result (*this); increment(); return result; } - constant_iterator& operator--() + BOOST_CONTAINER_FORCEINLINE constant_iterator& operator--() { decrement(); return *this; } - constant_iterator operator--(int) + BOOST_CONTAINER_FORCEINLINE constant_iterator operator--(int) { constant_iterator result (*this); decrement(); return result; } - friend bool operator== (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator== (const constant_iterator& i, const constant_iterator& i2) { return i.equal(i2); } - friend bool operator!= (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const constant_iterator& i, const constant_iterator& i2) { return !(i == i2); } - friend bool operator< (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator< (const constant_iterator& i, const constant_iterator& i2) { return i.less(i2); } - friend bool operator> (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator> (const constant_iterator& i, const constant_iterator& i2) { return i2 < i; } - friend bool operator<= (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const constant_iterator& i, const constant_iterator& i2) { return !(i > i2); } - friend bool operator>= (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const constant_iterator& i, const constant_iterator& i2) { return !(i < i2); } - friend Difference operator- (const constant_iterator& i, const constant_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const constant_iterator& i, const constant_iterator& i2) { return i2.distance_to(i); } //Arithmetic - constant_iterator& operator+=(Difference off) + BOOST_CONTAINER_FORCEINLINE constant_iterator& operator+=(Difference off) { this->advance(off); return *this; } - constant_iterator operator+(Difference off) const + BOOST_CONTAINER_FORCEINLINE constant_iterator operator+(Difference off) const { constant_iterator other(*this); other.advance(off); return other; } - friend constant_iterator operator+(Difference off, const constant_iterator& right) + BOOST_CONTAINER_FORCEINLINE friend constant_iterator operator+(Difference off, const constant_iterator& right) { return right + off; } - constant_iterator& operator-=(Difference off) + BOOST_CONTAINER_FORCEINLINE constant_iterator& operator-=(Difference off) { this->advance(-off); return *this; } - constant_iterator operator-(Difference off) const + BOOST_CONTAINER_FORCEINLINE constant_iterator operator-(Difference off) const { return *this + (-off); } - const T& operator*() const + BOOST_CONTAINER_FORCEINLINE const T& operator*() const { return dereference(); } - const T& operator[] (Difference ) const + BOOST_CONTAINER_FORCEINLINE const T& operator[] (Difference ) const { return dereference(); } - const T* operator->() const + BOOST_CONTAINER_FORCEINLINE const T* operator->() const { return &(dereference()); } private: const T * m_ptr; Difference m_num; - void increment() + BOOST_CONTAINER_FORCEINLINE void increment() { --m_num; } - void decrement() + BOOST_CONTAINER_FORCEINLINE void decrement() { ++m_num; } - bool equal(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const { return m_num == other.m_num; } - bool less(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const { return other.m_num < m_num; } - const T & dereference() const + BOOST_CONTAINER_FORCEINLINE const T & dereference() const { return *m_ptr; } - void advance(Difference n) + BOOST_CONTAINER_FORCEINLINE void advance(Difference n) { m_num -= n; } - Difference distance_to(const this_type &other)const + BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const { return m_num - other.m_num; } }; @@ -160,72 +160,72 @@ class value_init_construct_iterator typedef value_init_construct_iterator this_type; public: - explicit value_init_construct_iterator(Difference range_size) + BOOST_CONTAINER_FORCEINLINE explicit value_init_construct_iterator(Difference range_size) : m_num(range_size){} //Constructors - value_init_construct_iterator() + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator() : m_num(0){} - value_init_construct_iterator& operator++() + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator++() { increment(); return *this; } - value_init_construct_iterator operator++(int) + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator++(int) { value_init_construct_iterator result (*this); increment(); return result; } - value_init_construct_iterator& operator--() + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator--() { decrement(); return *this; } - value_init_construct_iterator operator--(int) + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator--(int) { value_init_construct_iterator result (*this); decrement(); return result; } - friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i.equal(i2); } - friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return !(i == i2); } - friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i.less(i2); } - friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i2 < i; } - friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return !(i > i2); } - friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return !(i < i2); } - friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2) { return i2.distance_to(i); } //Arithmetic - value_init_construct_iterator& operator+=(Difference off) + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator+=(Difference off) { this->advance(off); return *this; } - value_init_construct_iterator operator+(Difference off) const + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator+(Difference off) const { value_init_construct_iterator other(*this); other.advance(off); return other; } - friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right) + BOOST_CONTAINER_FORCEINLINE friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right) { return right + off; } - value_init_construct_iterator& operator-=(Difference off) + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator& operator-=(Difference off) { this->advance(-off); return *this; } - value_init_construct_iterator operator-(Difference off) const + BOOST_CONTAINER_FORCEINLINE value_init_construct_iterator operator-(Difference off) const { return *this + (-off); } //This pseudo-iterator's dereference operations have no sense since value is not @@ -238,28 +238,28 @@ class value_init_construct_iterator private: Difference m_num; - void increment() + BOOST_CONTAINER_FORCEINLINE void increment() { --m_num; } - void decrement() + BOOST_CONTAINER_FORCEINLINE void decrement() { ++m_num; } - bool equal(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const { return m_num == other.m_num; } - bool less(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const { return other.m_num < m_num; } - const T & dereference() const + BOOST_CONTAINER_FORCEINLINE const T & dereference() const { static T dummy; return dummy; } - void advance(Difference n) + BOOST_CONTAINER_FORCEINLINE void advance(Difference n) { m_num -= n; } - Difference distance_to(const this_type &other)const + BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const { return m_num - other.m_num; } }; @@ -271,72 +271,72 @@ class default_init_construct_iterator typedef default_init_construct_iterator this_type; public: - explicit default_init_construct_iterator(Difference range_size) + BOOST_CONTAINER_FORCEINLINE explicit default_init_construct_iterator(Difference range_size) : m_num(range_size){} //Constructors - default_init_construct_iterator() + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator() : m_num(0){} - default_init_construct_iterator& operator++() + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator++() { increment(); return *this; } - default_init_construct_iterator operator++(int) + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator++(int) { default_init_construct_iterator result (*this); increment(); return result; } - default_init_construct_iterator& operator--() + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator--() { decrement(); return *this; } - default_init_construct_iterator operator--(int) + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator--(int) { default_init_construct_iterator result (*this); decrement(); return result; } - friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i.equal(i2); } - friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return !(i == i2); } - friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i.less(i2); } - friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i2 < i; } - friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return !(i > i2); } - friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return !(i < i2); } - friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) + BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2) { return i2.distance_to(i); } //Arithmetic - default_init_construct_iterator& operator+=(Difference off) + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator+=(Difference off) { this->advance(off); return *this; } - default_init_construct_iterator operator+(Difference off) const + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator+(Difference off) const { default_init_construct_iterator other(*this); other.advance(off); return other; } - friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right) + BOOST_CONTAINER_FORCEINLINE friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right) { return right + off; } - default_init_construct_iterator& operator-=(Difference off) + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator& operator-=(Difference off) { this->advance(-off); return *this; } - default_init_construct_iterator operator-(Difference off) const + BOOST_CONTAINER_FORCEINLINE default_init_construct_iterator operator-(Difference off) const { return *this + (-off); } //This pseudo-iterator's dereference operations have no sense since value is not @@ -349,28 +349,28 @@ class default_init_construct_iterator private: Difference m_num; - void increment() + BOOST_CONTAINER_FORCEINLINE void increment() { --m_num; } - void decrement() + BOOST_CONTAINER_FORCEINLINE void decrement() { ++m_num; } - bool equal(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const { return m_num == other.m_num; } - bool less(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const { return other.m_num < m_num; } - const T & dereference() const + BOOST_CONTAINER_FORCEINLINE const T & dereference() const { static T dummy; return dummy; } - void advance(Difference n) + BOOST_CONTAINER_FORCEINLINE void advance(Difference n) { m_num -= n; } - Difference distance_to(const this_type &other)const + BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other) const { return m_num - other.m_num; } }; @@ -382,106 +382,106 @@ class repeat_iterator { typedef repeat_iterator this_type; public: - explicit repeat_iterator(T &ref, Difference range_size) + BOOST_CONTAINER_FORCEINLINE explicit repeat_iterator(T &ref, Difference range_size) : m_ptr(&ref), m_num(range_size){} //Constructors - repeat_iterator() + BOOST_CONTAINER_FORCEINLINE repeat_iterator() : m_ptr(0), m_num(0){} - this_type& operator++() + BOOST_CONTAINER_FORCEINLINE this_type& operator++() { increment(); return *this; } - this_type operator++(int) + BOOST_CONTAINER_FORCEINLINE this_type operator++(int) { this_type result (*this); increment(); return result; } - this_type& operator--() + BOOST_CONTAINER_FORCEINLINE this_type& operator--() { increment(); return *this; } - this_type operator--(int) + BOOST_CONTAINER_FORCEINLINE this_type operator--(int) { this_type result (*this); increment(); return result; } - friend bool operator== (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator== (const this_type& i, const this_type& i2) { return i.equal(i2); } - friend bool operator!= (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const this_type& i, const this_type& i2) { return !(i == i2); } - friend bool operator< (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator< (const this_type& i, const this_type& i2) { return i.less(i2); } - friend bool operator> (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator> (const this_type& i, const this_type& i2) { return i2 < i; } - friend bool operator<= (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const this_type& i, const this_type& i2) { return !(i > i2); } - friend bool operator>= (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const this_type& i, const this_type& i2) { return !(i < i2); } - friend Difference operator- (const this_type& i, const this_type& i2) + BOOST_CONTAINER_FORCEINLINE friend Difference operator- (const this_type& i, const this_type& i2) { return i2.distance_to(i); } //Arithmetic - this_type& operator+=(Difference off) + BOOST_CONTAINER_FORCEINLINE this_type& operator+=(Difference off) { this->advance(off); return *this; } - this_type operator+(Difference off) const + BOOST_CONTAINER_FORCEINLINE this_type operator+(Difference off) const { this_type other(*this); other.advance(off); return other; } - friend this_type operator+(Difference off, const this_type& right) + BOOST_CONTAINER_FORCEINLINE friend this_type operator+(Difference off, const this_type& right) { return right + off; } - this_type& operator-=(Difference off) + BOOST_CONTAINER_FORCEINLINE this_type& operator-=(Difference off) { this->advance(-off); return *this; } - this_type operator-(Difference off) const + BOOST_CONTAINER_FORCEINLINE this_type operator-(Difference off) const { return *this + (-off); } - T& operator*() const + BOOST_CONTAINER_FORCEINLINE T& operator*() const { return dereference(); } - T& operator[] (Difference ) const + BOOST_CONTAINER_FORCEINLINE T& operator[] (Difference ) const { return dereference(); } - T *operator->() const + BOOST_CONTAINER_FORCEINLINE T *operator->() const { return &(dereference()); } private: T * m_ptr; Difference m_num; - void increment() + BOOST_CONTAINER_FORCEINLINE void increment() { --m_num; } - void decrement() + BOOST_CONTAINER_FORCEINLINE void decrement() { ++m_num; } - bool equal(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool equal(const this_type &other) const { return m_num == other.m_num; } - bool less(const this_type &other) const + BOOST_CONTAINER_FORCEINLINE bool less(const this_type &other) const { return other.m_num < m_num; } - T & dereference() const + BOOST_CONTAINER_FORCEINLINE T & dereference() const { return *m_ptr; } - void advance(Difference n) + BOOST_CONTAINER_FORCEINLINE void advance(Difference n) { m_num -= n; } - Difference distance_to(const this_type &other)const + BOOST_CONTAINER_FORCEINLINE Difference distance_to(const this_type &other)const { return m_num - other.m_num; } }; @@ -503,7 +503,7 @@ class emplace_iterator BOOST_CONTAINER_FORCEINLINE this_type& operator++() { increment(); return *this; } - this_type operator++(int) + BOOST_CONTAINER_FORCEINLINE this_type operator++(int) { this_type result (*this); increment(); @@ -513,7 +513,7 @@ class emplace_iterator BOOST_CONTAINER_FORCEINLINE this_type& operator--() { decrement(); return *this; } - this_type operator--(int) + BOOST_CONTAINER_FORCEINLINE this_type operator--(int) { this_type result (*this); decrement(); @@ -545,7 +545,7 @@ class emplace_iterator BOOST_CONTAINER_FORCEINLINE this_type& operator+=(difference_type off) { this->advance(off); return *this; } - this_type operator+(difference_type off) const + BOOST_CONTAINER_FORCEINLINE this_type operator+(difference_type off) const { this_type other(*this); other.advance(off); @@ -571,11 +571,11 @@ class emplace_iterator public: template - void construct_in_place(Allocator &a, T* ptr) + BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* ptr) { (*m_pe)(a, ptr); } template - void assign_in_place(DestIt dest) + BOOST_CONTAINER_FORCEINLINE void assign_in_place(DestIt dest) { (*m_pe)(dest); } private: @@ -614,7 +614,7 @@ struct emplace_functor { typedef typename dtl::build_number_seq::type index_tuple_t; - emplace_functor(BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE emplace_functor(BOOST_FWD_REF(Args)... args) : args_(args...) {} @@ -661,15 +661,15 @@ struct emplace_functor_type; BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ struct emplace_functor##N\ {\ - explicit emplace_functor##N( BOOST_MOVE_UREF##N )\ + BOOST_CONTAINER_FORCEINLINE explicit emplace_functor##N( BOOST_MOVE_UREF##N )\ BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\ \ template\ - void operator()(Allocator &a, T *ptr)\ + BOOST_CONTAINER_FORCEINLINE void operator()(Allocator &a, T *ptr)\ { allocator_traits::construct(a, ptr BOOST_MOVE_I##N BOOST_MOVE_MFWD##N); }\ \ template\ - void operator()(DestIt dest)\ + BOOST_CONTAINER_FORCEINLINE void operator()(DestIt dest)\ {\ typedef typename boost::container::iterator_traits::value_type value_type;\ BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), dtl::value_init tmp) ;\ diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index 5b68b97..ec5a487 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -202,19 +202,19 @@ class list // ////////////////////////////////////////////// - typedef T value_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef ValueAllocator allocator_type; - typedef BOOST_CONTAINER_IMPDEF(NodeAlloc) stored_allocator_type; - typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; - typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; + typedef T value_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef ValueAllocator allocator_type; + typedef BOOST_CONTAINER_IMPDEF(NodeAlloc) stored_allocator_type; + typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; + typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) reverse_iterator; + typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator) const_reverse_iterator; ////////////////////////////////////////////// // diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 8af730b..d41132d 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -80,14 +80,14 @@ template class clear_on_destroy { public: - clear_on_destroy(C &c) + BOOST_CONTAINER_FORCEINLINE clear_on_destroy(C &c) : c_(c), do_clear_(true) {} - void release() + BOOST_CONTAINER_FORCEINLINE void release() { do_clear_ = false; } - ~clear_on_destroy() + BOOST_CONTAINER_FORCEINLINE ~clear_on_destroy() { if(do_clear_){ c_.clear(); @@ -121,11 +121,11 @@ struct node_base ::type node_base_ptr_ptr; public: - explicit node_base(const node_base_ptr_ptr &n) + BOOST_CONTAINER_FORCEINLINE explicit node_base(const node_base_ptr_ptr &n) : up(n) {} - node_base() + BOOST_CONTAINER_FORCEINLINE node_base() : up() {} @@ -220,7 +220,7 @@ struct index_traits // Node cache first is *(this->index.end() - 2); // Node cache last is this->index.back(); - static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n) + BOOST_CONTAINER_FORCEINLINE static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n) { return node_base_ptr_ptr_traits::pointer_to(n); } static void fix_up_pointers(index_iterator first, index_iterator last) @@ -233,10 +233,10 @@ struct index_traits } } - static index_iterator get_fix_up_end(index_type &index) + BOOST_CONTAINER_FORCEINLINE static index_iterator get_fix_up_end(index_type &index) { return index.end() - (ExtraPointers - 1); } - static void fix_up_pointers_from(index_type & index, index_iterator first) + BOOST_CONTAINER_FORCEINLINE static void fix_up_pointers_from(index_type & index, index_iterator first) { index_traits::fix_up_pointers(first, index_traits::get_fix_up_end(index)); } static void readjust_end_node(index_type &index, node_base_type &end_node) @@ -316,11 +316,11 @@ class stable_vector_iterator public: - explicit stable_vector_iterator(node_base_ptr p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE explicit stable_vector_iterator(node_base_ptr p) BOOST_NOEXCEPT_OR_NOTHROW : m_pn(p) {} - stable_vector_iterator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator() BOOST_NOEXCEPT_OR_NOTHROW : m_pn() //Value initialization to achieve "null iterators" (N3644) {} @@ -333,86 +333,86 @@ class stable_vector_iterator public: //Pointer like operators - reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW { return node_pointer()->get_data(); } - pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW { return ptr_traits::pointer_to(this->operator*()); } //Increment / Decrement - stable_vector_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW { node_base_ptr_ptr p(this->m_pn->up); this->m_pn = *(++p); return *this; } - stable_vector_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW { stable_vector_iterator tmp(*this); ++*this; return stable_vector_iterator(tmp); } - stable_vector_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW { node_base_ptr_ptr p(this->m_pn->up); this->m_pn = *(--p); return *this; } - stable_vector_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW { stable_vector_iterator tmp(*this); --*this; return stable_vector_iterator(tmp); } - reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW + 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(); } - stable_vector_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { if(off) this->m_pn = this->m_pn->up[off]; return *this; } - friend stable_vector_iterator operator+(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend stable_vector_iterator operator+(difference_type off, const stable_vector_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW + 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; return tmp; } - stable_vector_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW { *this += -off; return *this; } - friend stable_vector_iterator operator-(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend difference_type operator-(const stable_vector_iterator &left, const stable_vector_iterator &right) BOOST_NOEXCEPT_OR_NOTHROW + 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 - friend bool operator== (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator!= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator< (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator<= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator> (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } - friend bool operator>= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW + 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; } }; @@ -520,16 +520,16 @@ class stable_vector allocator_version_traits allocator_version_traits_t; typedef typename allocator_version_traits_t::multiallocation_chain multiallocation_chain; - node_ptr allocate_one() + BOOST_CONTAINER_FORCEINLINE node_ptr allocate_one() { return allocator_version_traits_t::allocate_one(this->priv_node_alloc()); } - void deallocate_one(const node_ptr &p) + BOOST_CONTAINER_FORCEINLINE void deallocate_one(const node_ptr &p) { allocator_version_traits_t::deallocate_one(this->priv_node_alloc(), p); } - void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m) + BOOST_CONTAINER_FORCEINLINE void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m) { allocator_version_traits_t::allocate_individual(this->priv_node_alloc(), n, m); } - void deallocate_individual(multiallocation_chain &holder) + BOOST_CONTAINER_FORCEINLINE void deallocate_individual(multiallocation_chain &holder) { allocator_version_traits_t::deallocate_individual(this->priv_node_alloc(), holder); } friend class stable_vector_detail::clear_on_destroy; @@ -585,7 +585,7 @@ class stable_vector //! Throws: If allocator_type's default constructor throws. //! //! Complexity: Constant. - stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) + BOOST_CONTAINER_FORCEINLINE stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : internal_data(), index() { STABLE_VECTOR_CHECK_INVARIANT; @@ -596,7 +596,7 @@ class stable_vector //! Throws: Nothing //! //! Complexity: Constant. - explicit stable_vector(const allocator_type& al) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE explicit stable_vector(const allocator_type& al) BOOST_NOEXCEPT_OR_NOTHROW : internal_data(al), index(al) { STABLE_VECTOR_CHECK_INVARIANT; @@ -743,7 +743,7 @@ class stable_vector //! Throws: If allocator_type's copy constructor throws. //! //! Complexity: Constant. - stable_vector(BOOST_RV_REF(stable_vector) x) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stable_vector(BOOST_RV_REF(stable_vector) x) BOOST_NOEXCEPT_OR_NOTHROW : internal_data(boost::move(x.priv_node_alloc())), index(boost::move(x.index)) { this->priv_swap_members(x); @@ -883,7 +883,7 @@ class stable_vector //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to n. - void assign(size_type n, const T& t) + BOOST_CONTAINER_FORCEINLINE void assign(size_type n, const T& t) { typedef constant_iterator cvalue_iterator; this->assign(cvalue_iterator(t, n), cvalue_iterator()); @@ -922,7 +922,7 @@ class stable_vector //! Throws: If memory allocation throws or //! T's constructor from dereferencing initializer_list iterator throws. //! - void assign(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list il) { STABLE_VECTOR_CHECK_INVARIANT; assign(il.begin(), il.end()); @@ -934,7 +934,7 @@ class stable_vector //! Throws: If allocator's copy constructor throws. //! //! Complexity: Constant. - allocator_type get_allocator() const + BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const { return this->priv_node_alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -944,7 +944,7 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -954,7 +954,7 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return this->priv_node_alloc(); } ////////////////////////////////////////////// @@ -968,7 +968,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -976,7 +976,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -984,7 +984,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -992,7 +992,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1001,7 +1001,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1010,7 +1010,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1019,7 +1019,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1028,7 +1028,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1036,7 +1036,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1044,7 +1044,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW { return this->end(); } //! Effects: Returns a const_reverse_iterator pointing to the beginning @@ -1053,7 +1053,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1062,7 +1062,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW { return this->rend(); } ////////////////////////////////////////////// @@ -1076,7 +1076,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1084,7 +1084,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW + 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)); @@ -1095,7 +1095,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + 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 @@ -1240,7 +1240,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference front() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index.front()).get_data(); @@ -1254,7 +1254,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index.front()).get_data(); @@ -1268,7 +1268,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE reference back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); return static_cast(*this->index[this->size()-1u]).get_data(); @@ -1296,7 +1296,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW + 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(); @@ -1310,7 +1310,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant. - const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + 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(); @@ -1327,7 +1327,7 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW + 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])); @@ -1344,7 +1344,7 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW + 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])); @@ -1360,7 +1360,7 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW + 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(). @@ -1373,7 +1373,7 @@ class stable_vector //! Complexity: Constant. //! //! Note: Non-standard extension - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW + 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. @@ -1559,7 +1559,7 @@ class stable_vector //! Returns: an iterator to the first inserted element or p if first == last. //! //! Complexity: Linear to distance [il.begin(), il.end()). - iterator insert(const_iterator p, std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, std::initializer_list il) { //Position checks done by insert() STABLE_VECTOR_CHECK_INVARIANT; @@ -1646,7 +1646,7 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Constant time. - void pop_back() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void pop_back() BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(!this->empty()); this->erase(--this->cend()); @@ -1658,7 +1658,7 @@ class stable_vector //! //! Complexity: Linear to the elements between p and the //! last element. Constant if p is the last element. - iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW { BOOST_ASSERT(this->priv_in_range(p)); STABLE_VECTOR_CHECK_INVARIANT; @@ -1729,49 +1729,49 @@ class stable_vector //! Throws: Nothing. //! //! Complexity: Linear to the number of elements in the stable_vector. - void clear() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void clear() BOOST_NOEXCEPT_OR_NOTHROW { this->erase(this->cbegin(),this->cend()); } //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - friend bool operator==(const stable_vector& x, const stable_vector& y) + 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. - friend bool operator!=(const stable_vector& x, const stable_vector& y) + 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. - friend bool operator<(const stable_vector& x, const stable_vector& y) + 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. - friend bool operator>(const stable_vector& x, const stable_vector& y) + 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. - friend bool operator<=(const stable_vector& x, const stable_vector& y) + 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. - friend bool operator>=(const stable_vector& x, const stable_vector& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const stable_vector& x, const stable_vector& y) { return !(x < y); } //! Effects: x.swap(y) //! //! Complexity: Constant. - friend void swap(stable_vector& x, stable_vector& y) + BOOST_CONTAINER_FORCEINLINE friend void swap(stable_vector& x, stable_vector& y) { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -1782,12 +1782,12 @@ class stable_vector return (this->begin() <= pos) && (pos < this->end()); } - bool priv_in_range_or_end(const_iterator pos) const + BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const { return (this->begin() <= pos) && (pos <= this->end()); } - size_type priv_index_of(node_ptr p) const + BOOST_CONTAINER_FORCEINLINE size_type priv_index_of(node_ptr p) const { //Check range BOOST_ASSERT(this->index.empty() || (this->index.data() <= p->up)); @@ -1821,18 +1821,18 @@ class stable_vector class push_back_rollback { public: - push_back_rollback(stable_vector &sv, const node_ptr &p) + BOOST_CONTAINER_FORCEINLINE push_back_rollback(stable_vector &sv, const node_ptr &p) : m_sv(sv), m_p(p) {} - ~push_back_rollback() + BOOST_CONTAINER_FORCEINLINE ~push_back_rollback() { if(m_p){ m_sv.priv_put_in_pool(m_p); } } - void release() + BOOST_CONTAINER_FORCEINLINE void release() { m_p = node_ptr(); } private: @@ -1862,7 +1862,7 @@ class stable_vector return index_beg + idx; } - bool priv_capacity_bigger_than_size() const + BOOST_CONTAINER_FORCEINLINE bool priv_capacity_bigger_than_size() const { return this->index.capacity() > this->index.size() && this->internal_data.pool_size > 0; @@ -1995,16 +1995,16 @@ class stable_vector return ret; } - node_base_ptr priv_get_end_node() const + BOOST_CONTAINER_FORCEINLINE node_base_ptr priv_get_end_node() const { return node_base_ptr_traits::pointer_to(const_cast(this->internal_data.end_node)); } - void priv_destroy_node(const node_type &n) + BOOST_CONTAINER_FORCEINLINE void priv_destroy_node(const node_type &n) { allocator_traits:: destroy(this->priv_node_alloc(), &n); } - void priv_delete_node(const node_ptr &n) + BOOST_CONTAINER_FORCEINLINE void priv_delete_node(const node_ptr &n) { this->priv_destroy_node(*n); this->priv_put_in_pool(n);