Introduced BOOST_CONTAINER_FORCEINLINE so that mandatory inlining can be disabled selectively

This commit is contained in:
Ion Gaztañaga
2015-12-24 10:22:38 +01:00
parent a3262c0ae7
commit 75f7c8fa73
9 changed files with 211 additions and 187 deletions

View File

@@ -45,6 +45,7 @@ doxygen autodoc
\"BOOST_CONTAINER_SCOPEDALLOC_DUMMYTRUE=\"\\
\"BOOST_CONTAINER_SCOPEDALLOC_ALLINNER=InnerAllocs...\"\\
\"BOOST_CONTAINER_DECL=\"\\
\"BOOST_CONTAINER_FORCEINLINE=inline\" \\
"
<xsl:param>"boost.doxygen.reftitle=Boost.Container Header Reference"
;

View File

@@ -45,7 +45,9 @@
#pragma warning (disable : 4702) // unreachable code
#pragma warning (disable : 4706) // assignment within conditional expression
#pragma warning (disable : 4710) // function not inlined
#pragma warning (disable : 4714) // "function": marked as __forceinline not inlined
#pragma warning (disable : 4711) // function selected for automatic inline expansion
#pragma warning (disable : 4786) // identifier truncated in debug info
#pragma warning (disable : 4996) // "function": was declared deprecated
#endif //BOOST_MSVC

View File

@@ -377,7 +377,7 @@ class default_init_construct_iterator
template <class T, class Difference = std::ptrdiff_t>
class repeat_iterator
: public ::boost::container::iterator
<std::random_access_iterator_tag, T, Difference>
<std::random_access_iterator_tag, T, Difference, T*, T&>
{
typedef repeat_iterator<T, Difference> this_type;
public:
@@ -493,13 +493,13 @@ class emplace_iterator
public:
typedef Difference difference_type;
explicit emplace_iterator(EmplaceFunctor&e)
BOOST_CONTAINER_FORCEINLINE explicit emplace_iterator(EmplaceFunctor&e)
: m_num(1), m_pe(&e){}
emplace_iterator()
BOOST_CONTAINER_FORCEINLINE emplace_iterator()
: m_num(0), m_pe(0){}
this_type& operator++()
BOOST_CONTAINER_FORCEINLINE this_type& operator++()
{ increment(); return *this; }
this_type operator++(int)
@@ -509,7 +509,7 @@ class emplace_iterator
return result;
}
this_type& operator--()
BOOST_CONTAINER_FORCEINLINE this_type& operator--()
{ decrement(); return *this; }
this_type operator--(int)
@@ -519,29 +519,29 @@ class emplace_iterator
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_type operator- (const this_type& i, const this_type& i2)
BOOST_CONTAINER_FORCEINLINE friend difference_type operator- (const this_type& i, const this_type& i2)
{ return i2.distance_to(i); }
//Arithmetic
this_type& operator+=(difference_type off)
BOOST_CONTAINER_FORCEINLINE this_type& operator+=(difference_type off)
{ this->advance(off); return *this; }
this_type operator+(difference_type off) const
@@ -551,13 +551,13 @@ class emplace_iterator
return other;
}
friend this_type operator+(difference_type off, const this_type& right)
BOOST_CONTAINER_FORCEINLINE friend this_type operator+(difference_type off, const this_type& right)
{ return right + off; }
this_type& operator-=(difference_type off)
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
{ return *this + (-off); }
//This pseudo-iterator's dereference operations have no sense since value is not
@@ -575,28 +575,28 @@ class emplace_iterator
difference_type m_num;
EmplaceFunctor * m_pe;
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_type n)
BOOST_CONTAINER_FORCEINLINE void advance(difference_type n)
{ m_num -= n; }
difference_type distance_to(const this_type &other)const
BOOST_CONTAINER_FORCEINLINE difference_type distance_to(const this_type &other)const
{ return difference_type(m_num - other.m_num); }
};
@@ -616,7 +616,7 @@ struct emplace_functor
{ emplace_functor::inplace_impl(a, ptr, index_tuple_t()); }
template<class Allocator, class T, int ...IdxPack>
void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
{
allocator_traits<Allocator>::construct
(a, ptr, ::boost::forward<Args>(container_detail::get<IdxPack>(args_))...);
@@ -762,54 +762,54 @@ class iterator_from_iiterator
typedef typename types_t::iterator_category iterator_category;
typedef typename types_t::value_type value_type;
iterator_from_iiterator()
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator()
{}
explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE explicit iterator_from_iiterator(IIterator iit) BOOST_NOEXCEPT_OR_NOTHROW
: m_iit(iit)
{}
iterator_from_iiterator(iterator_from_iiterator<IIterator, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator(iterator_from_iiterator<IIterator, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_iit(other.get())
{}
iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
{ ++this->m_iit; return *this; }
iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
{
iterator_from_iiterator result (*this);
++this->m_iit;
return result;
}
iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
{
//If the iterator_from_iiterator is not a bidirectional iterator, operator-- should not exist
BOOST_STATIC_ASSERT((is_bidirectional_iterator<iterator_from_iiterator>::value));
--this->m_iit; return *this;
}
iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator_from_iiterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
{
iterator_from_iiterator result (*this);
--this->m_iit;
return result;
}
friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_iit == r.m_iit; }
friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const iterator_from_iiterator& l, const iterator_from_iiterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return !(l == r); }
reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_iit->get_data(); }
pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
{ return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*()); }
const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const IIterator &get() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_iit; }
private:

View File

@@ -136,13 +136,13 @@ struct tree_node
typedef tree_node< T, VoidPointer
, tree_type_value, OptimizeSize> node_type;
T &get_data()
BOOST_CONTAINER_FORCEINLINE T &get_data()
{
T* ptr = reinterpret_cast<T*>(&this->m_data);
return *ptr;
}
const T &get_data() const
BOOST_CONTAINER_FORCEINLINE const T &get_data() const
{
const T* ptr = reinterpret_cast<const T*>(&this->m_data);
return *ptr;
@@ -151,39 +151,39 @@ struct tree_node
internal_type m_data;
template<class T1, class T2>
void do_assign(const std::pair<const T1, T2> &p)
BOOST_CONTAINER_FORCEINLINE void do_assign(const std::pair<const T1, T2> &p)
{
const_cast<T1&>(m_data.first) = p.first;
m_data.second = p.second;
}
template<class T1, class T2>
void do_assign(const pair<const T1, T2> &p)
BOOST_CONTAINER_FORCEINLINE void do_assign(const pair<const T1, T2> &p)
{
const_cast<T1&>(m_data.first) = p.first;
m_data.second = p.second;
}
template<class V>
void do_assign(const V &v)
BOOST_CONTAINER_FORCEINLINE void do_assign(const V &v)
{ m_data = v; }
template<class T1, class T2>
void do_move_assign(std::pair<const T1, T2> &p)
BOOST_CONTAINER_FORCEINLINE void do_move_assign(std::pair<const T1, T2> &p)
{
const_cast<T1&>(m_data.first) = ::boost::move(p.first);
m_data.second = ::boost::move(p.second);
}
template<class T1, class T2>
void do_move_assign(pair<const T1, T2> &p)
BOOST_CONTAINER_FORCEINLINE void do_move_assign(pair<const T1, T2> &p)
{
const_cast<T1&>(m_data.first) = ::boost::move(p.first);
m_data.second = ::boost::move(p.second);
}
template<class V>
void do_move_assign(V &v)
BOOST_CONTAINER_FORCEINLINE void do_move_assign(V &v)
{ m_data = ::boost::move(v); }
};

View File

@@ -76,4 +76,17 @@
#define BOOST_CONTAINER_DECL
#endif /* DYN_LINK */
//#define BOOST_CONTAINER_DISABLE_FORCEINLINE
#if defined(BOOST_CONTAINER_DISABLE_FORCEINLINE)
#define BOOST_CONTAINER_FORCEINLINE inline
#elif defined(BOOST_CONTAINER_FORCEINLINE_IS_BOOST_FORCELINE)
#define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE
#elif defined(BOOST_MSVC) && defined(_DEBUG)
//"__forceinline" and MSVC seems to have some bugs in debug mode
#define BOOST_CONTAINER_FORCEINLINE inline
#else
#define BOOST_CONTAINER_FORCEINLINE BOOST_FORCEINLINE
#endif
#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP

View File

@@ -91,10 +91,10 @@ class small_vector_allocator
BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator)
const Allocator &as_base() const
BOOST_CONTAINER_FORCEINLINE const Allocator &as_base() const
{ return static_cast<const Allocator&>(*this); }
Allocator &as_base()
BOOST_CONTAINER_FORCEINLINE Allocator &as_base()
{ return static_cast<Allocator&>(*this); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -135,13 +135,13 @@ class small_vector_allocator
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//!Constructor from arbitrary arguments
template<class ...Args>
explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args)
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args)
: Allocator(::boost::forward<Args>(args)...)
{}
#else
#define BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
explicit small_vector_allocator(BOOST_MOVE_UREF##N)\
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\
: Allocator(BOOST_MOVE_FWD##N)\
{}\
//
@@ -151,54 +151,54 @@ class small_vector_allocator
//!Constructor from other small_vector_allocator.
//!Never throws
small_vector_allocator(const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator(const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(other.as_base())
{}
//!Move constructor from small_vector_allocator.
//!Never throws
small_vector_allocator(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(::boost::move(other.as_base()))
{}
//!Constructor from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
small_vector_allocator(const small_vector_allocator<OtherAllocator> &other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator(const small_vector_allocator<OtherAllocator> &other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(other.as_base())
{}
//!Move constructor from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
small_vector_allocator(BOOST_RV_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator(BOOST_RV_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(::boost::move(other.as_base()))
{}
//!Assignment from other small_vector_allocator.
//!Never throws
small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->Allocator::operator=(other.as_base())); }
//!Move constructor from other small_vector_allocator.
//!Never throws
small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->Allocator::operator=(::boost::move(other.as_base()))); }
//!Assignment from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator & operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->Allocator::operator=(other.as_base())); }
//!Move assignment from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE small_vector_allocator & operator=(BOOST_RV_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->Allocator::operator=(::boost::move(other.as_base()))); }
//!Allocates storage from the standard-conforming allocator
pointer allocate(size_type count, const_void_pointer hint = const_void_pointer())
BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer())
{ return allocator_traits_type::allocate(this->as_base(), count, hint); }
//!Deallocates previously allocated memory.
@@ -211,7 +211,7 @@ class small_vector_allocator
//!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 allocator_traits_type::max_size(this->as_base()); }
small_vector_allocator select_on_container_copy_construction() const
@@ -222,17 +222,17 @@ class small_vector_allocator
//!Swaps two allocators, does nothing
//!because this small_vector_allocator is stateless
friend void swap(small_vector_allocator &l, small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend void swap(small_vector_allocator &l, small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
{ boost::adl_move_swap(l.as_base(), r.as_base()); }
//!An small_vector_allocator always compares to true, as memory allocated with one
//!instance can be deallocated by another instance (except for unpropagable storage)
friend bool operator==(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator==(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
{ return allocator_traits_type::equal(l.as_base(), r.as_base()); }
//!An small_vector_allocator always compares to false, as memory allocated with one
//!instance can be deallocated by another instance
friend bool operator!=(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
{ return !(l == r); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -268,7 +268,7 @@ class small_vector_allocator
using Allocator::allocate_many;
using Allocator::deallocate_many;*/
bool is_internal_storage(pointer p) const
BOOST_CONTAINER_FORCEINLINE bool is_internal_storage(pointer p) const
{ return this->internal_storage() == p; }
pointer internal_storage() const
@@ -344,16 +344,16 @@ class small_vector_base
protected:
typedef typename base_type::initial_capacity_t initial_capacity_t;
explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity)
BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity)
: base_type(initial_capacity_t(), this->internal_storage(), initial_capacity)
{}
template<class AllocFwd>
explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a)
BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a)
: base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<AllocFwd>(a))
{}
~small_vector_base(){}
//~small_vector_base(){}
using base_type::is_propagable_from;
using base_type::steal_resources;
@@ -365,13 +365,13 @@ class small_vector_base
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other)
BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other)
{ return static_cast<small_vector_base&>(this->base_type::operator=(static_cast<base_type const&>(other))); }
small_vector_base& operator=(BOOST_RV_REF(small_vector_base) other)
BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_RV_REF(small_vector_base) other)
{ return static_cast<small_vector_base&>(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); }
void swap(small_vector_base &other)
BOOST_CONTAINER_FORCEINLINE void swap(small_vector_base &other)
{ return this->base_type::swap(other); }
};
@@ -477,21 +477,21 @@ class small_vector : public small_vector_base<T, Allocator>
typedef typename base_type::size_type size_type;
typedef typename base_type::value_type value_type;
static std::size_t internal_capacity()
BOOST_CONTAINER_FORCEINLINE static std::size_t internal_capacity()
{ return (sizeof(small_vector) - storage_test::s_start)/sizeof(T); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
small_vector()
BOOST_CONTAINER_FORCEINLINE small_vector()
: base_type(initial_capacity_t(), internal_capacity())
{}
explicit small_vector(size_type n)
BOOST_CONTAINER_FORCEINLINE explicit small_vector(size_type n)
: base_type(initial_capacity_t(), internal_capacity())
{ this->resize(n); }
explicit small_vector(const allocator_type &a)
BOOST_CONTAINER_FORCEINLINE explicit small_vector(const allocator_type &a)
: base_type(initial_capacity_t(), internal_capacity(), a)
{}
@@ -524,13 +524,13 @@ class small_vector : public small_vector_base<T, Allocator>
}
#endif
small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other)
BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other)
{ return static_cast<small_vector&>(this->base_type::operator=(static_cast<base_type const&>(other))); }
small_vector& operator=(BOOST_RV_REF(small_vector) other)
BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(small_vector) other)
{ return static_cast<small_vector&>(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); }
void swap(small_vector &other)
BOOST_CONTAINER_FORCEINLINE void swap(small_vector &other)
{ return this->base_type::swap(other); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -41,29 +41,29 @@ class static_storage_allocator
public:
typedef T value_type;
static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW
{}
static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{}
static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_cast<T*>(static_cast<const T*>(static_cast<const void*>(&storage))); }
T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<T*>(static_cast<void*>(&storage)); }
static const std::size_t internal_capacity = N;
typedef boost::container::container_detail::version_type<static_storage_allocator, 0> version;
friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{ return false; }
friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW
{ return true; }
private:
@@ -143,7 +143,7 @@ public:
//!
//! @par Complexity
//! Constant O(1).
static_vector() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE static_vector() BOOST_NOEXCEPT_OR_NOTHROW
: base_t()
{}
@@ -158,7 +158,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
explicit static_vector(size_type count)
BOOST_CONTAINER_FORCEINLINE explicit static_vector(size_type count)
: base_t(count)
{}
@@ -176,7 +176,7 @@ public:
//!
//! @par Note
//! Non-standard extension
static_vector(size_type count, default_init_t)
BOOST_CONTAINER_FORCEINLINE static_vector(size_type count, default_init_t)
: base_t(count, default_init_t())
{}
@@ -192,7 +192,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector(size_type count, value_type const& value)
BOOST_CONTAINER_FORCEINLINE static_vector(size_type count, value_type const& value)
: base_t(count, value)
{}
@@ -211,7 +211,7 @@ public:
//! @par Complexity
//! Linear O(N).
template <typename Iterator>
static_vector(Iterator first, Iterator last)
BOOST_CONTAINER_FORCEINLINE static_vector(Iterator first, Iterator last)
: base_t(first, last)
{}
@@ -228,7 +228,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector(std::initializer_list<value_type> il)
BOOST_CONTAINER_FORCEINLINE static_vector(std::initializer_list<value_type> il)
: base_t(il)
{}
#endif
@@ -242,7 +242,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector(static_vector const& other)
BOOST_CONTAINER_FORCEINLINE static_vector(static_vector const& other)
: base_t(other)
{}
@@ -258,7 +258,7 @@ public:
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
static_vector(static_vector<value_type, C> const& other)
BOOST_CONTAINER_FORCEINLINE static_vector(static_vector<value_type, C> const& other)
: base_t(other)
{}
@@ -272,7 +272,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector(BOOST_RV_REF(static_vector) other)
BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF(static_vector) other)
: base_t(BOOST_MOVE_BASE(base_t, other))
{}
@@ -289,7 +289,7 @@ public:
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
static_vector(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
: base_t(BOOST_MOVE_BASE(typename static_vector<value_type BOOST_MOVE_I C>::base_t, other))
{}
@@ -302,7 +302,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other)
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other)
{
return static_cast<static_vector&>(base_t::operator=(static_cast<base_t const&>(other)));
}
@@ -317,7 +317,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector & operator=(std::initializer_list<value_type> il)
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(std::initializer_list<value_type> il)
{ return static_cast<static_vector&>(base_t::operator=(il)); }
#endif
@@ -333,7 +333,7 @@ public:
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
static_vector & operator=(static_vector<value_type, C> const& other)
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(static_vector<value_type, C> const& other)
{
return static_cast<static_vector&>(base_t::operator=
(static_cast<typename static_vector<value_type, C>::base_t const&>(other)));
@@ -349,7 +349,7 @@ public:
//!
//! @par Complexity
//! Linear O(N).
static_vector & operator=(BOOST_RV_REF(static_vector) other)
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF(static_vector) other)
{
return static_cast<static_vector&>(base_t::operator=(BOOST_MOVE_BASE(base_t, other)));
}
@@ -367,7 +367,7 @@ public:
//! @par Complexity
//! Linear O(N).
template <std::size_t C>
static_vector & operator=(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other)
{
return static_cast<static_vector&>(base_t::operator=
(BOOST_MOVE_BASE(typename static_vector<value_type BOOST_MOVE_I C>::base_t, other)));
@@ -578,7 +578,6 @@ public:
template <typename Iterator>
iterator insert(const_iterator p, Iterator first, Iterator last);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @pre
//! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
//! @li <tt>distance(il.begin(), il.end()) <= capacity()</tt>
@@ -594,7 +593,6 @@ public:
//! @par Complexity
//! Linear O(N).
iterator insert(const_iterator p, std::initializer_list<value_type> il);
#endif
//! @pre \c p must be a valid iterator of \c *this in range <tt>[begin(), end())</tt>
//!
@@ -640,7 +638,6 @@ public:
template <typename Iterator>
void assign(Iterator first, Iterator last);
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
//! @pre <tt>distance(il.begin(), il.end()) <= capacity()</tt>
//!
//! @brief Assigns a range <tt>[il.begin(), il.end())</tt> of Values to this container.
@@ -653,7 +650,6 @@ public:
//! @par Complexity
//! Linear O(N).
void assign(std::initializer_list<value_type> il);
#endif
//! @pre <tt>count <= capacity()</tt>
//!
@@ -1095,7 +1091,7 @@ public:
bool empty() const BOOST_NOEXCEPT_OR_NOTHROW;
#else
friend void swap(static_vector &x, static_vector &y)
BOOST_CONTAINER_FORCEINLINE friend void swap(static_vector &x, static_vector &y)
{
x.swap(y);
}

View File

@@ -96,13 +96,13 @@ class vec_iterator
Pointer m_ptr;
public:
const Pointer &get_ptr() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const Pointer &get_ptr() const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_ptr; }
Pointer &get_ptr() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr() BOOST_NOEXCEPT_OR_NOTHROW
{ return m_ptr; }
explicit vec_iterator(Pointer ptr) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE explicit vec_iterator(Pointer ptr) BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr(ptr)
{}
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -110,73 +110,73 @@ class vec_iterator
public:
//Constructors
vec_iterator() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator() BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr() //Value initialization to achieve "null iterators" (N3644)
{}
vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_NOEXCEPT_OR_NOTHROW
: m_ptr(other.get_ptr())
{}
//Pointer like operators
reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW
{ return *m_ptr; }
pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW
{ return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*()); }
reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW
{ return m_ptr[off]; }
//Increment / Decrement
vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW
{ ++m_ptr; return *this; }
vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW
{ return vec_iterator(m_ptr++); }
vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW
{ --m_ptr; return *this; }
vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW
{ return vec_iterator(m_ptr--); }
//Arithmetic
vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ m_ptr += off; return *this; }
vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ m_ptr -= off; return *this; }
friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ return vec_iterator(x.m_ptr+off); }
friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_NOEXCEPT_OR_NOTHROW
{ right.m_ptr += off; return right; }
friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW
{ left.m_ptr -= off; return left; }
friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW
{ return left.m_ptr - right.m_ptr; }
//Comparison operators
friend bool operator== (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator== (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr == r.m_ptr; }
friend bool operator!= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator!= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr != r.m_ptr; }
friend bool operator< (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator< (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr < r.m_ptr; }
friend bool operator<= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator<= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr <= r.m_ptr; }
friend bool operator> (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator> (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr > r.m_ptr; }
friend bool operator>= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE friend bool operator>= (const vec_iterator& l, const vec_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW
{ return l.m_ptr >= r.m_ptr; }
};
@@ -186,7 +186,7 @@ struct vector_insert_ordered_cursor
typedef typename iterator_traits<BiDirPosConstIt>::value_type size_type;
typedef typename iterator_traits<BiDirValueIt>::reference reference;
vector_insert_ordered_cursor(BiDirPosConstIt posit, BiDirValueIt valueit)
BOOST_CONTAINER_FORCEINLINE vector_insert_ordered_cursor(BiDirPosConstIt posit, BiDirValueIt valueit)
: last_position_it(posit), last_value_it(valueit)
{}
@@ -200,10 +200,10 @@ struct vector_insert_ordered_cursor
}
}
size_type get_pos() const
BOOST_CONTAINER_FORCEINLINE size_type get_pos() const
{ return *last_position_it; }
reference get_val()
BOOST_CONTAINER_FORCEINLINE reference get_val()
{ return *last_value_it; }
BiDirPosConstIt last_position_it;
@@ -216,7 +216,7 @@ struct vector_merge_cursor
typedef SizeType size_type;
typedef typename iterator_traits<BiDirValueIt>::reference reference;
vector_merge_cursor(T *pbeg, T *plast, BiDirValueIt valueit, Comp &cmp)
BOOST_CONTAINER_FORCEINLINE vector_merge_cursor(T *pbeg, T *plast, BiDirValueIt valueit, Comp &cmp)
: m_pbeg(pbeg), m_pcur(--plast), m_valueit(valueit), m_cmp(cmp)
{}
@@ -232,10 +232,10 @@ struct vector_merge_cursor
}
}
size_type get_pos() const
BOOST_CONTAINER_FORCEINLINE size_type get_pos() const
{ return static_cast<size_type>((m_pcur + 1) - m_pbeg); }
reference get_val()
BOOST_CONTAINER_FORCEINLINE reference get_val()
{ return *m_valueit; }
T *const m_pbeg;
@@ -247,11 +247,11 @@ struct vector_merge_cursor
} //namespace container_detail {
template<class Pointer, bool IsConst>
const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
{ return it.get_ptr(); }
template<class Pointer, bool IsConst>
Pointer &get_ptr(container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr(container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_NOEXCEPT_OR_NOTHROW
{ return it.get_ptr(); }
namespace container_detail {
@@ -270,7 +270,7 @@ struct vector_get_ptr_pointer_to_non_const
typedef typename pointer_traits_t
::template rebind_pointer<non_const_element_type>::type return_type;
static return_type get_ptr(const const_pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE static return_type get_ptr(const const_pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
{ return boost::intrusive::pointer_traits<return_type>::const_cast_from(ptr); }
};
@@ -278,14 +278,14 @@ template<class Pointer>
struct vector_get_ptr_pointer_to_non_const<Pointer, false>
{
typedef const Pointer & return_type;
static return_type get_ptr(const Pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE static return_type get_ptr(const Pointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
{ return ptr; }
};
} //namespace container_detail {
template<class MaybeConstPointer>
typename container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::return_type
BOOST_CONTAINER_FORCEINLINE typename container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::return_type
vector_iterator_get_ptr(const MaybeConstPointer &ptr) BOOST_NOEXCEPT_OR_NOTHROW
{
return container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::get_ptr(ptr);
@@ -451,14 +451,14 @@ struct vector_alloc_holder
, m_capacity(n)
{}
~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE ~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW
{
if(this->m_capacity){
this->alloc().deallocate(this->m_start, this->m_capacity);
}
}
pointer allocation_command(boost::container::allocation_type command,
BOOST_CONTAINER_FORCEINLINE pointer allocation_command(boost::container::allocation_type command,
size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse)
{
typedef typename container_detail::version<Allocator>::type alloc_version;
@@ -482,7 +482,7 @@ struct vector_alloc_holder
return success;
}
size_type next_capacity(size_type additional_objects) const
BOOST_CONTAINER_FORCEINLINE size_type next_capacity(size_type additional_objects) const
{
return next_capacity_calculator
<size_type, NextCapacityDouble //NextCapacity60Percent
@@ -510,10 +510,10 @@ struct vector_alloc_holder
x.m_size = x.m_capacity = 0;
}
Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
const pointer &start() const BOOST_NOEXCEPT_OR_NOTHROW { return m_start; }
@@ -534,7 +534,7 @@ struct vector_alloc_holder
}
}
pointer priv_allocation_command(version_1, boost::container::allocation_type command,
BOOST_CONTAINER_FORCEINLINE pointer priv_allocation_command(version_1, boost::container::allocation_type command,
size_type ,
size_type &prefer_in_recvd_out_size,
pointer &reuse)
@@ -624,14 +624,14 @@ struct vector_alloc_holder<Allocator, version_0>
(this->alloc(), container_detail::to_raw_pointer(holder.start()), n, container_detail::to_raw_pointer(this->start()));
}
void priv_first_allocation(size_type cap)
BOOST_CONTAINER_FORCEINLINE void priv_first_allocation(size_type cap)
{
if(cap > Allocator::internal_capacity){
throw_bad_alloc();
}
}
void deep_swap(vector_alloc_holder &x)
BOOST_CONTAINER_FORCEINLINE void deep_swap(vector_alloc_holder &x)
{
this->priv_deep_swap(x);
}
@@ -645,28 +645,28 @@ struct vector_alloc_holder<Allocator, version_0>
this->priv_deep_swap(x);
}
void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE void swap_resources(vector_alloc_holder &) BOOST_NOEXCEPT_OR_NOTHROW
{ //Containers with version 0 allocators can't be moved without moving elements one by one
throw_bad_alloc();
}
void steal_resources(vector_alloc_holder &)
BOOST_CONTAINER_FORCEINLINE void steal_resources(vector_alloc_holder &)
{ //Containers with version 0 allocators can't be moved without moving elements one by one
throw_bad_alloc();
}
Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE Allocator &alloc() BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW
{ return *this; }
bool try_expand_fwd(size_type at_least)
BOOST_CONTAINER_FORCEINLINE bool try_expand_fwd(size_type at_least)
{ return !at_least; }
pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_storage(); }
size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_capacity; }
BOOST_CONTAINER_FORCEINLINE pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_storage(); }
BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_capacity; }
size_type m_size;
private:
@@ -765,16 +765,16 @@ class vector
protected:
void steal_resources(vector &x)
BOOST_CONTAINER_FORCEINLINE void steal_resources(vector &x)
{ return this->m_holder.steal_resources(x.m_holder); }
struct initial_capacity_t{};
template<class AllocFwd>
vector(initial_capacity_t, pointer initial_memory, size_type capacity, BOOST_FWD_REF(AllocFwd) a)
BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type capacity, BOOST_FWD_REF(AllocFwd) a)
: m_holder(initial_memory, capacity, ::boost::forward<AllocFwd>(a))
{}
vector(initial_capacity_t, pointer initial_memory, size_type capacity)
BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type capacity)
: m_holder(initial_memory, capacity)
{}
@@ -1063,7 +1063,7 @@ class vector
//! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
//!
//! <b>Complexity</b>: Linear to the number of elements in x.
vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
BOOST_CONTAINER_FORCEINLINE vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
{
if (&x != this){
this->priv_copy_assign(x);
@@ -1075,7 +1075,7 @@ class vector
//! <b>Effects</b>: Make *this container contains elements from il.
//!
//! <b>Complexity</b>: Linear to the range [il.begin(), il.end()).
vector& operator=(std::initializer_list<value_type> il)
BOOST_CONTAINER_FORCEINLINE vector& operator=(std::initializer_list<value_type> il)
{
this->assign(il.begin(), il.end());
return *this;
@@ -1093,7 +1093,7 @@ class vector
//! <b>Complexity</b>: Constant if allocator_traits_type::
//! propagate_on_container_move_assignment is true or
//! this->get>allocator() == x.get_allocator(). Linear otherwise.
vector& operator=(BOOST_RV_REF(vector) x)
BOOST_CONTAINER_FORCEINLINE vector& operator=(BOOST_RV_REF(vector) x)
BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value
|| allocator_traits_type::is_always_equal::value)
{
@@ -1115,7 +1115,7 @@ class vector
//!
//! <b>Note</b>: Non-standard extension to support static_vector
template<class OtherAllocator>
typename container_detail::enable_if_and
BOOST_CONTAINER_FORCEINLINE typename container_detail::enable_if_and
< vector&
, container_detail::is_version<OtherAllocator, 0>
, container_detail::is_different<OtherAllocator, allocator_type>
@@ -1137,7 +1137,7 @@ class vector
//!
//! <b>Note</b>: Non-standard extension to support static_vector
template<class OtherAllocator>
typename container_detail::enable_if_and
BOOST_CONTAINER_FORCEINLINE typename container_detail::enable_if_and
< vector&
, container_detail::is_version<OtherAllocator, 0>
, container_detail::is_different<OtherAllocator, allocator_type>
@@ -1193,7 +1193,7 @@ class vector
//! <b>Throws</b>: If memory allocation throws or
//! T's constructor from dereferencing iniializer_list iterator throws.
//!
void assign(std::initializer_list<T> il)
BOOST_CONTAINER_FORCEINLINE void assign(std::initializer_list<T> il)
{
this->assign(il.begin(), il.end());
}
@@ -1269,7 +1269,7 @@ class vector
//! T's copy/move constructor/assignment throws.
//!
//! <b>Complexity</b>: Linear to n.
void assign(size_type n, const value_type& val)
BOOST_CONTAINER_FORCEINLINE void assign(size_type n, const value_type& val)
{ this->assign(cvalue_iterator(val, n), cvalue_iterator()); }
//! <b>Effects</b>: Returns a copy of the internal allocator.
@@ -1287,7 +1287,7 @@ class vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: 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->m_holder.alloc(); }
//! <b>Effects</b>: Returns a reference to the internal allocator.
@@ -1297,7 +1297,7 @@ class vector
//! <b>Complexity</b>: Constant.
//!
//! <b>Note</b>: 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->m_holder.alloc(); }
//////////////////////////////////////////////
@@ -1311,7 +1311,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW
{ return iterator(this->m_holder.start()); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
@@ -1319,7 +1319,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->m_holder.start()); }
//! <b>Effects</b>: Returns an iterator to the end of the vector.
@@ -1327,7 +1327,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
iterator end() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW
{ return iterator(this->m_holder.start() + this->m_holder.m_size); }
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
@@ -1335,7 +1335,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->cend(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
@@ -1344,7 +1344,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW
{ return reverse_iterator(this->end()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -1353,7 +1353,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: 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(); }
//! <b>Effects</b>: Returns a reverse_iterator pointing to the end
@@ -1362,7 +1362,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW
{ return reverse_iterator(this->begin()); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -1371,7 +1371,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: 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(); }
//! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
@@ -1379,7 +1379,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->m_holder.start()); }
//! <b>Effects</b>: Returns a const_iterator to the end of the vector.
@@ -1387,7 +1387,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW
{ return const_iterator(this->m_holder.start() + this->m_holder.m_size); }
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
@@ -1396,7 +1396,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: 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->end());}
//! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
@@ -1405,7 +1405,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: 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->begin()); }
//////////////////////////////////////////////
@@ -1419,7 +1419,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW
{ return !this->m_holder.m_size; }
//! <b>Effects</b>: Returns the number of the elements contained in the vector.
@@ -1427,7 +1427,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_holder.m_size; }
//! <b>Effects</b>: Returns the largest possible size of the vector.
@@ -1435,7 +1435,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: 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->m_holder.alloc()); }
//! <b>Effects</b>: Inserts or erases elements at the end such that
@@ -1473,7 +1473,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW
{ return this->m_holder.capacity(); }
//! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
@@ -1482,7 +1482,7 @@ class vector
//! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
//!
//! <b>Throws</b>: If memory allocation allocation throws or T's copy/move constructor throws.
void reserve(size_type new_cap)
BOOST_CONTAINER_FORCEINLINE void reserve(size_type new_cap)
{
if (this->capacity() < new_cap){
this->priv_reserve_no_capacity(new_cap, alloc_version());
@@ -1495,7 +1495,7 @@ class vector
//! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Linear to size().
void shrink_to_fit()
BOOST_CONTAINER_FORCEINLINE void shrink_to_fit()
{ this->priv_shrink_to_fit(alloc_version()); }
//////////////////////////////////////////////
@@ -1722,7 +1722,7 @@ class vector
//!
//! <b>Complexity</b>: Amortized constant time.
template<class ...Args>
void emplace_back(BOOST_FWD_REF(Args)...args)
BOOST_CONTAINER_FORCEINLINE void emplace_back(BOOST_FWD_REF(Args)...args)
{
if (BOOST_LIKELY(this->room_enough())){
//There is more memory, just construct a new object at the end
@@ -1745,7 +1745,7 @@ class vector
//!
//! <b>Note</b>: Non-standard extension.
template<class ...Args>
bool stable_emplace_back(BOOST_FWD_REF(Args)...args)
BOOST_CONTAINER_FORCEINLINE bool stable_emplace_back(BOOST_FWD_REF(Args)...args)
{
const bool is_room_enough = this->room_enough() || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(1u));
if (BOOST_LIKELY(is_room_enough)){
@@ -1780,7 +1780,7 @@ class vector
#define BOOST_CONTAINER_VECTOR_EMPLACE_CODE(N) \
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
void emplace_back(BOOST_MOVE_UREF##N)\
BOOST_CONTAINER_FORCEINLINE void emplace_back(BOOST_MOVE_UREF##N)\
{\
if (BOOST_LIKELY(this->room_enough())){\
allocator_traits_type::construct (this->m_holder.alloc()\
@@ -1795,7 +1795,7 @@ class vector
}\
\
BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
bool stable_emplace_back(BOOST_MOVE_UREF##N)\
BOOST_CONTAINER_FORCEINLINE bool stable_emplace_back(BOOST_MOVE_UREF##N)\
{\
const bool is_room_enough = this->room_enough() || (alloc_version::value == 2 && this->m_holder.try_expand_fwd(1u));\
if (BOOST_LIKELY(is_room_enough)){\
@@ -1837,7 +1837,7 @@ class vector
//! <b>Complexity</b>: Amortized constant time.
void push_back(T &&x);
#else
BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
BOOST_CONTAINER_FORCEINLINE BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
#endif
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)

View File

@@ -151,9 +151,15 @@
<Filter
Name="test"
Filter="">
<File
RelativePath="..\..\test\allocator_argument_tester.hpp">
</File>
<File
RelativePath="..\..\test\check_equal_containers.hpp">
</File>
<File
RelativePath="..\..\test\container_common_tests.hpp">
</File>
<File
RelativePath="..\..\test\default_init_test.hpp">
</File>
@@ -202,6 +208,9 @@
<File
RelativePath="..\..\test\map_test.hpp">
</File>
<File
RelativePath="..\..\test\memory_resource_logger.hpp">
</File>
<File
RelativePath="..\..\test\movable_int.hpp">
</File>
@@ -214,6 +223,9 @@
<File
RelativePath="..\..\test\propagate_allocator_test.hpp">
</File>
<File
RelativePath="..\..\test\propagation_test_allocator.hpp">
</File>
<File
RelativePath="..\..\test\set_test.hpp">
</File>