From 649d6d04785cb018ebd59d484727d5184c6851a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 25 May 2020 00:14:15 +0200 Subject: [PATCH] Add BOOST_CONTAINER_FORCEINLINE in more places --- .../boost/container/detail/alloc_helpers.hpp | 12 +- .../detail/dispatch_uses_allocator.hpp | 12 +- include/boost/container/list.hpp | 48 +++--- include/boost/container/scoped_allocator.hpp | 160 +++++++++--------- include/boost/container/vector.hpp | 4 +- 5 files changed, 118 insertions(+), 118 deletions(-) diff --git a/include/boost/container/detail/alloc_helpers.hpp b/include/boost/container/detail/alloc_helpers.hpp index 57c59e4..5ca2ca7 100644 --- a/include/boost/container/detail/alloc_helpers.hpp +++ b/include/boost/container/detail/alloc_helpers.hpp @@ -27,30 +27,30 @@ namespace container { namespace dtl { template -inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) +BOOST_CONTAINER_FORCEINLINE void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) +BOOST_CONTAINER_FORCEINLINE void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { boost::adl_move_swap(l, r); } template -inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) +BOOST_CONTAINER_FORCEINLINE void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) +BOOST_CONTAINER_FORCEINLINE void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) { l = r; } template -inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) +BOOST_CONTAINER_FORCEINLINE void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) +BOOST_CONTAINER_FORCEINLINE void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { l = ::boost::move(r); } } //namespace dtl { diff --git a/include/boost/container/detail/dispatch_uses_allocator.hpp b/include/boost/container/detail/dispatch_uses_allocator.hpp index ff88e27..e4ed7ab 100644 --- a/include/boost/container/detail/dispatch_uses_allocator.hpp +++ b/include/boost/container/detail/dispatch_uses_allocator.hpp @@ -110,7 +110,7 @@ template < typename ConstructAlloc , typename T , class ...Args > -inline typename dtl::enable_if_and +BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < void , dtl::is_not_pair , dtl::not_< uses_allocator > @@ -127,7 +127,7 @@ template < typename ConstructAlloc , typename T , class ...Args > -inline typename dtl::enable_if_and +BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < void , dtl::is_not_pair , uses_allocator @@ -146,7 +146,7 @@ template < typename ConstructAlloc , typename T , class ...Args > -inline typename dtl::enable_if_and +BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < void , dtl::is_not_pair , uses_allocator @@ -162,7 +162,7 @@ inline typename dtl::enable_if_and #define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ template \ - inline typename dtl::enable_if_and\ + BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and\ < void\ , dtl::is_not_pair\ , dtl::not_ >\ @@ -179,7 +179,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR #define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ - inline typename dtl::enable_if_and\ + BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and\ < void\ , dtl::is_not_pair\ , uses_allocator\ @@ -197,7 +197,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR #define BOOST_CONTAINER_SCOPED_ALLOCATOR_DISPATCH_USES_ALLOCATOR_CODE(N) \ template < typename ConstructAlloc, typename ArgAlloc, typename T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ - inline typename dtl::enable_if_and\ + BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and\ < void\ , dtl::is_not_pair\ , uses_allocator\ diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index f9ff663..2c25f4a 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -354,7 +354,7 @@ class list //! Throws: Nothing. //! //! Complexity: Linear to the number of elements. - ~list() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE ~list() BOOST_NOEXCEPT_OR_NOTHROW {} //AllocHolder clears the list //! Effects: Makes *this contain the same elements as x. @@ -430,9 +430,9 @@ class list //! Throws: If memory allocation throws or T's copy constructor throws. //! //! Complexity: Linear to the number of elements in x. - list& operator=(std::initializer_list il) + BOOST_CONTAINER_FORCEINLINE list& operator=(std::initializer_list il) { - assign(il.begin(), il.end()); + this->assign(il.begin(), il.end()); return *this; } #endif @@ -442,7 +442,7 @@ class list //! 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 cvalue_iterator; return this->assign(cvalue_iterator(val, n), cvalue_iterator()); @@ -479,8 +479,8 @@ class list //! T's constructor from dereferencing std::initializer_list iterator throws. //! //! Complexity: Linear to n. - void assign(std::initializer_list il) - { assign(il.begin(), il.end()); } + BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list il) + { this->assign(il.begin(), il.end()); } #endif //! Effects: Returns a copy of the internal allocator. @@ -488,7 +488,7 @@ class list //! 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 allocator_type(this->node_alloc()); } //! Effects: Returns a reference to the internal allocator. @@ -498,7 +498,7 @@ class list //! 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->node_alloc(); } //! Effects: Returns a reference to the internal allocator. @@ -508,7 +508,7 @@ class list //! 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->node_alloc(); } ////////////////////////////////////////////// @@ -522,7 +522,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW + 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 +530,7 @@ class list //! 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->cbegin(); } //! Effects: Returns an iterator to the end of the list. @@ -538,7 +538,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW + 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 +546,7 @@ class list //! 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->cend(); } //! Effects: Returns a reverse_iterator pointing to the beginning @@ -555,7 +555,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW + 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 +564,7 @@ class list //! 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 this->crbegin(); } //! Effects: Returns a reverse_iterator pointing to the end @@ -573,7 +573,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW + 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 +582,7 @@ class list //! 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 this->crend(); } //! Effects: Returns a const_iterator to the first element contained in the list. @@ -590,7 +590,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW + 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 +598,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW + 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 +607,7 @@ class list //! 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->cend()); } //! Effects: Returns a const_reverse_iterator pointing to the end @@ -616,7 +616,7 @@ class list //! 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->cbegin()); } ////////////////////////////////////////////// @@ -630,7 +630,7 @@ class list //! Throws: Nothing. //! //! Complexity: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW + 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 +638,7 @@ class list //! 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->icont().size(); } //! Effects: Returns the largest possible size of the list. @@ -646,7 +646,7 @@ class list //! 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 AllocHolder::max_size(); } //! Effects: Inserts or erases elements at the end such that diff --git a/include/boost/container/scoped_allocator.hpp b/include/boost/container/scoped_allocator.hpp index 6cd69fe..e9720fe 100644 --- a/include/boost/container/scoped_allocator.hpp +++ b/include/boost/container/scoped_allocator.hpp @@ -79,10 +79,10 @@ struct outermost_allocator_imp { typedef MaybeScopedAlloc type; - static type &get(MaybeScopedAlloc &a) + BOOST_CONTAINER_FORCEINLINE static type &get(MaybeScopedAlloc &a) { return a; } - static const type &get(const MaybeScopedAlloc &a) + BOOST_CONTAINER_FORCEINLINE static const type &get(const MaybeScopedAlloc &a) { return a; } }; @@ -92,10 +92,10 @@ struct outermost_allocator_imp typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; typedef typename outermost_allocator_type_impl::type type; - static type &get(MaybeScopedAlloc &a) + BOOST_CONTAINER_FORCEINLINE static type &get(MaybeScopedAlloc &a) { return outermost_allocator_imp::get(a.outer_allocator()); } - static const type &get(const MaybeScopedAlloc &a) + BOOST_CONTAINER_FORCEINLINE static const type &get(const MaybeScopedAlloc &a) { return outermost_allocator_imp::get(a.outer_allocator()); } }; @@ -112,12 +112,12 @@ struct outermost_allocator {}; template -typename outermost_allocator::type & +BOOST_CONTAINER_FORCEINLINE typename outermost_allocator::type & get_outermost_allocator(Allocator &a) { return outermost_allocator::get(a); } template -const typename outermost_allocator::type & +BOOST_CONTAINER_FORCEINLINE const typename outermost_allocator::type & get_outermost_allocator(const Allocator &a) { return outermost_allocator::get(a); } @@ -161,34 +161,34 @@ class scoped_allocator_adaptor_base inner_allocator_type::is_always_equal::value > is_always_equal; - scoped_allocator_adaptor_base() + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base() {} template - scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args) : outer_allocator_type(::boost::forward(outerAlloc)) , m_inner(args...) {} - scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) : outer_allocator_type(other.outer_allocator()) , m_inner(other.inner_allocator()) {} - scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) : outer_allocator_type(::boost::move(other.outer_allocator())) , m_inner(::boost::move(other.inner_allocator())) {} template - scoped_allocator_adaptor_base + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base (const scoped_allocator_adaptor_base& other) : outer_allocator_type(other.outer_allocator()) , m_inner(other.inner_allocator()) {} template - scoped_allocator_adaptor_base + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base (BOOST_RV_REF_BEG scoped_allocator_adaptor_base BOOST_RV_REF_END other) : outer_allocator_type(other.outer_allocator()) @@ -199,7 +199,7 @@ class scoped_allocator_adaptor_base struct internal_type_t{}; template - scoped_allocator_adaptor_base + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base ( internal_type_t , BOOST_FWD_REF(OuterA2) outerAlloc , const inner_allocator_type &inner) @@ -209,7 +209,7 @@ class scoped_allocator_adaptor_base public: - scoped_allocator_adaptor_base &operator= + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base &operator= (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) { outer_allocator_type::operator=(other.outer_allocator()); @@ -217,35 +217,35 @@ class scoped_allocator_adaptor_base return *this; } - scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) { outer_allocator_type::operator=(boost::move(other.outer_allocator())); m_inner = ::boost::move(other.inner_allocator()); return *this; } - void swap(scoped_allocator_adaptor_base &r) + BOOST_CONTAINER_FORCEINLINE void swap(scoped_allocator_adaptor_base &r) { boost::adl_move_swap(this->outer_allocator(), r.outer_allocator()); boost::adl_move_swap(this->m_inner, r.inner_allocator()); } - friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) + BOOST_CONTAINER_FORCEINLINE friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) { l.swap(r); } - inner_allocator_type& inner_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE inner_allocator_type& inner_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return m_inner; } - inner_allocator_type const& inner_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE inner_allocator_type const& inner_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return m_inner; } - outer_allocator_type & outer_allocator() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE outer_allocator_type & outer_allocator() BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(*this); } - const outer_allocator_type &outer_allocator() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE const outer_allocator_type &outer_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { return static_cast(*this); } - scoped_allocator_type select_on_container_copy_construction() const + BOOST_CONTAINER_FORCEINLINE scoped_allocator_type select_on_container_copy_construction() const { return scoped_allocator_type (internal_type_t() @@ -304,33 +304,33 @@ class scoped_allocator_adaptor_base\ inner_allocator_type::is_always_equal::value\ > is_always_equal;\ \ - scoped_allocator_adaptor_base(){}\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(){}\ \ template \ - scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, BOOST_MOVE_CREF##N)\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, BOOST_MOVE_CREF##N)\ : outer_allocator_type(::boost::forward(outerAlloc))\ , m_inner(BOOST_MOVE_ARG##N)\ {}\ \ - scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other)\ : outer_allocator_type(other.outer_allocator())\ , m_inner(other.inner_allocator())\ {}\ \ - scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other)\ : outer_allocator_type(::boost::move(other.outer_allocator()))\ , m_inner(::boost::move(other.inner_allocator()))\ {}\ \ template \ - scoped_allocator_adaptor_base\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base\ (const scoped_allocator_adaptor_base& other)\ : outer_allocator_type(other.outer_allocator())\ , m_inner(other.inner_allocator())\ {}\ \ template \ - scoped_allocator_adaptor_base\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base\ (BOOST_RV_REF_BEG scoped_allocator_adaptor_base BOOST_RV_REF_END other)\ : outer_allocator_type(other.outer_allocator())\ , m_inner(other.inner_allocator())\ @@ -340,14 +340,14 @@ class scoped_allocator_adaptor_base\ struct internal_type_t{};\ \ template \ - scoped_allocator_adaptor_base\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base\ ( internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &inner)\ : outer_allocator_type(::boost::forward(outerAlloc))\ , m_inner(inner)\ {}\ \ public:\ - scoped_allocator_adaptor_base &operator=\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base &operator=\ (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other)\ {\ outer_allocator_type::operator=(other.outer_allocator());\ @@ -355,35 +355,35 @@ class scoped_allocator_adaptor_base\ return *this;\ }\ \ - scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other)\ {\ outer_allocator_type::operator=(boost::move(other.outer_allocator()));\ m_inner = ::boost::move(other.inner_allocator());\ return *this;\ }\ \ - void swap(scoped_allocator_adaptor_base &r)\ + BOOST_CONTAINER_FORCEINLINE void swap(scoped_allocator_adaptor_base &r)\ {\ boost::adl_move_swap(this->outer_allocator(), r.outer_allocator());\ boost::adl_move_swap(this->m_inner, r.inner_allocator());\ }\ \ - friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)\ + BOOST_CONTAINER_FORCEINLINE friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)\ { l.swap(r); }\ \ - inner_allocator_type& inner_allocator()\ + BOOST_CONTAINER_FORCEINLINE inner_allocator_type& inner_allocator()\ { return m_inner; }\ \ - inner_allocator_type const& inner_allocator() const\ + BOOST_CONTAINER_FORCEINLINE inner_allocator_type const& inner_allocator() const\ { return m_inner; }\ \ - outer_allocator_type & outer_allocator()\ + BOOST_CONTAINER_FORCEINLINE outer_allocator_type & outer_allocator()\ { return static_cast(*this); }\ \ - const outer_allocator_type &outer_allocator() const\ + BOOST_CONTAINER_FORCEINLINE const outer_allocator_type &outer_allocator() const\ { return static_cast(*this); }\ \ - scoped_allocator_type select_on_container_copy_construction() const\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_type select_on_container_copy_construction() const\ {\ return scoped_allocator_type\ (internal_type_t()\ @@ -440,30 +440,30 @@ class scoped_allocator_adaptor_base< OuterAlloc BOOST_CONTAINER_SCOPEDALLOC_DUMM typedef typename outer_traits_type:: is_always_equal is_always_equal; - scoped_allocator_adaptor_base() + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base() {} template - scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc) : outer_allocator_type(::boost::forward(outerAlloc)) {} - scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) : outer_allocator_type(other.outer_allocator()) {} - scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) : outer_allocator_type(::boost::move(other.outer_allocator())) {} template - scoped_allocator_adaptor_base + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base (const scoped_allocator_adaptor_base& other) : outer_allocator_type(other.outer_allocator()) {} template - scoped_allocator_adaptor_base + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base (BOOST_RV_REF_BEG scoped_allocator_adaptor_base BOOST_RV_REF_END other) : outer_allocator_type(other.outer_allocator()) {} @@ -472,44 +472,44 @@ class scoped_allocator_adaptor_base< OuterAlloc BOOST_CONTAINER_SCOPEDALLOC_DUMM struct internal_type_t{}; template - scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &) : outer_allocator_type(::boost::forward(outerAlloc)) {} public: - scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) { outer_allocator_type::operator=(other.outer_allocator()); return *this; } - scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) { outer_allocator_type::operator=(boost::move(other.outer_allocator())); return *this; } - void swap(scoped_allocator_adaptor_base &r) + BOOST_CONTAINER_FORCEINLINE void swap(scoped_allocator_adaptor_base &r) { boost::adl_move_swap(this->outer_allocator(), r.outer_allocator()); } - friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) + BOOST_CONTAINER_FORCEINLINE friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) { l.swap(r); } - inner_allocator_type& inner_allocator() + BOOST_CONTAINER_FORCEINLINE inner_allocator_type& inner_allocator() { return static_cast(*this); } - inner_allocator_type const& inner_allocator() const + BOOST_CONTAINER_FORCEINLINE inner_allocator_type const& inner_allocator() const { return static_cast(*this); } - outer_allocator_type & outer_allocator() + BOOST_CONTAINER_FORCEINLINE outer_allocator_type & outer_allocator() { return static_cast(*this); } - const outer_allocator_type &outer_allocator() const + BOOST_CONTAINER_FORCEINLINE const outer_allocator_type &outer_allocator() const { return static_cast(*this); } - scoped_allocator_type select_on_container_copy_construction() const + BOOST_CONTAINER_FORCEINLINE scoped_allocator_type select_on_container_copy_construction() const { return scoped_allocator_type (internal_type_t() @@ -641,21 +641,21 @@ class scoped_allocator_adaptor //! Effects: value-initializes the OuterAlloc base class //! and the inner allocator object. - scoped_allocator_adaptor() + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor() {} - ~scoped_allocator_adaptor() + BOOST_CONTAINER_FORCEINLINE ~scoped_allocator_adaptor() {} //! Effects: initializes each allocator within the adaptor with //! the corresponding allocator from other. - scoped_allocator_adaptor(const scoped_allocator_adaptor& other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(const scoped_allocator_adaptor& other) : base_type(other.base()) {} //! Effects: move constructs each allocator within the adaptor with //! the corresponding allocator from other. - scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other) : base_type(::boost::move(other.base())) {} @@ -667,14 +667,14 @@ class scoped_allocator_adaptor //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the //! corresponding allocator from the argument list). template - scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs) : base_type(::boost::forward(outerAlloc), innerAllocs...) {} #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #define BOOST_CONTAINER_SCOPED_ALLOCATOR_ADAPTOR_RELATED_ALLOCATOR_CONSTRUCTOR_CODE(N)\ template \ - scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc BOOST_MOVE_I##N BOOST_MOVE_CREF##N)\ + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc BOOST_MOVE_I##N BOOST_MOVE_CREF##N)\ : base_type(::boost::forward(outerAlloc) BOOST_MOVE_I##N BOOST_MOVE_ARG##N)\ {}\ // @@ -687,7 +687,7 @@ class scoped_allocator_adaptor //! //! Effects: initializes each allocator within the adaptor with the corresponding allocator from other. template - scoped_allocator_adaptor(const scoped_allocator_adaptor &other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(const scoped_allocator_adaptor &other) : base_type(other.base()) {} @@ -696,15 +696,15 @@ class scoped_allocator_adaptor //! Effects: initializes each allocator within the adaptor with the corresponding allocator //! rvalue from other. template - scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor BOOST_RV_REF_END other) : base_type(::boost::move(other.base())) {} - scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other) { return static_cast(base_type::operator=(static_cast(other))); } - scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other) { return static_cast(base_type::operator=(boost::move(other.base()))); } #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -736,13 +736,13 @@ class scoped_allocator_adaptor //! Returns: //! allocator_traits:: max_size(outer_allocator()). - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW { return outer_traits_type::max_size(this->outer_allocator()); } //! Effects: //! calls OUTERMOST_ALLOC_TRAITS(*this):: destroy(OUTERMOST(*this), p). template - void destroy(T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void destroy(T* p) BOOST_NOEXCEPT_OR_NOTHROW { allocator_traits::type> ::destroy(get_outermost_allocator(this->outer_allocator()), p); @@ -750,17 +750,17 @@ class scoped_allocator_adaptor //! Returns: //! allocator_traits::allocate(outer_allocator(), n). - pointer allocate(size_type n) + BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type n) { return outer_traits_type::allocate(this->outer_allocator(), n); } //! Returns: //! allocator_traits::allocate(outer_allocator(), n, hint). - pointer allocate(size_type n, const_void_pointer hint) + BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type n, const_void_pointer hint) { return outer_traits_type::allocate(this->outer_allocator(), n, hint); } //! Effects: //! allocator_traits::deallocate(outer_allocator(), p, n). - void deallocate(pointer p, size_type n) + BOOST_CONTAINER_FORCEINLINE void deallocate(pointer p, size_type n) { outer_traits_type::deallocate(this->outer_allocator(), p, n); } #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -772,9 +772,9 @@ class scoped_allocator_adaptor #endif //BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - base_type &base() { return *this; } + BOOST_CONTAINER_FORCEINLINE base_type &base() { return *this; } - const base_type &base() const { return *this; } + BOOST_CONTAINER_FORCEINLINE const base_type &base() const { return *this; } #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -808,7 +808,7 @@ class scoped_allocator_adaptor //! to true but the specific constructor does not take an allocator. This definition prevents a silent //! failure to pass an inner allocator to a contained element. -end note] template < typename T, class ...Args> - void construct(T* p, BOOST_FWD_REF(Args)...args) + BOOST_CONTAINER_FORCEINLINE void construct(T* p, BOOST_FWD_REF(Args)...args) { dtl::dispatch_uses_allocator ( (get_outermost_allocator)(this->outer_allocator()) @@ -821,7 +821,7 @@ class scoped_allocator_adaptor //overload selection problems when the first parameter is a pair. #define BOOST_CONTAINER_SCOPED_ALLOCATOR_CONSTRUCT_CODE(N) \ template < typename T BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\ - void construct(T* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\ + BOOST_CONTAINER_FORCEINLINE void construct(T* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\ {\ dtl::dispatch_uses_allocator\ ( (get_outermost_allocator)(this->outer_allocator())\ @@ -838,7 +838,7 @@ class scoped_allocator_adaptor public: //Internal function template - scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner) + BOOST_CONTAINER_FORCEINLINE scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner) : base_type(internal_type_t(), ::boost::forward(outer), inner) {} @@ -853,17 +853,17 @@ struct scoped_allocator_operator_equal //Optimize equal outer allocator types with //allocator_traits::equal which uses is_always_equal template - static bool equal_outer(const IA &l, const IA &r) + BOOST_CONTAINER_FORCEINLINE static bool equal_outer(const IA &l, const IA &r) { return allocator_traits::equal(l, r); } //Otherwise compare it normally template - static bool equal_outer(const IA1 &l, const IA2 &r) + BOOST_CONTAINER_FORCEINLINE static bool equal_outer(const IA1 &l, const IA2 &r) { return l == r; } //Otherwise compare it normally template - static bool equal_inner(const IA &l, const IA &r) + BOOST_CONTAINER_FORCEINLINE static bool equal_inner(const IA &l, const IA &r) { return allocator_traits::equal(l, r); } }; @@ -875,14 +875,14 @@ struct scoped_allocator_operator_equal //inner_allocator_type is the same as outer_allocator_type //so both types can be different in operator== template - static bool equal_inner(const IA1 &, const IA2 &) + BOOST_CONTAINER_FORCEINLINE static bool equal_inner(const IA1 &, const IA2 &) { return true; } }; /// @endcond template -inline bool operator==(const scoped_allocator_adaptor& a +BOOST_CONTAINER_FORCEINLINE bool operator==(const scoped_allocator_adaptor& a ,const scoped_allocator_adaptor& b) { #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -896,7 +896,7 @@ inline bool operator==(const scoped_allocator_adaptor -inline bool operator!=(const scoped_allocator_adaptor& a +BOOST_CONTAINER_FORCEINLINE bool operator!=(const scoped_allocator_adaptor& a ,const scoped_allocator_adaptor& b) { return !(a == b); } diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 099a878..1e3c8a6 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -288,7 +288,7 @@ struct vector_alloc_holder typedef typename allocator_traits_type::size_type size_type; typedef typename allocator_traits_type::value_type value_type; - static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc, bool const propagate_allocator) + BOOST_CONTAINER_FORCEINLINE static bool is_propagable_from(const allocator_type &from_alloc, pointer p, const allocator_type &to_alloc, bool const propagate_allocator) { (void)propagate_allocator; (void)p; (void)to_alloc; (void)from_alloc; const bool all_storage_propagable = !allocator_traits_type::is_partially_propagable::value || @@ -296,7 +296,7 @@ struct vector_alloc_holder return all_storage_propagable && (propagate_allocator || allocator_traits_type::equal(from_alloc, to_alloc)); } - static bool are_swap_propagable(const allocator_type &l_a, pointer l_p, const allocator_type &r_a, pointer r_p, bool const propagate_allocator) + BOOST_CONTAINER_FORCEINLINE static bool are_swap_propagable(const allocator_type &l_a, pointer l_p, const allocator_type &r_a, pointer r_p, bool const propagate_allocator) { (void)propagate_allocator; (void)l_p; (void)r_p; (void)l_a; (void)r_a; const bool all_storage_propagable = !allocator_traits_type::is_partially_propagable::value ||