Default allocator parameter changed form new_alloator<T> to void to reduce symbol lenghts

This commit is contained in:
Ion Gaztañaga
2019-01-10 22:54:58 +01:00
parent 80789255b9
commit 83bb62fed3
18 changed files with 417 additions and 358 deletions

View File

@@ -1244,6 +1244,7 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes_boost_1_70_00 Boost 1.70 Release]
* Removed support for already deprecated GCC < 4.3 and MSVC < 9.0 (Visual 2008) compilers.
* Default allocator parameter changed form `new_alloator<T>` to `void` to reduce symbol lenghts.
* Fixed bugs:
* [@https://github.com/boostorg/container/pull/96 GitHub #96: ['"Workaround: Intel compilers do not offer CTAD yet"]].
* [@https://github.com/boostorg/container/issues/97 GitHub #97: ['"buffer overflow in boost::container::flat_map on FreeBSD"]].

View File

@@ -77,7 +77,7 @@ namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template<class Allocator>
template<class T, class VoidAllocator>
class small_vector_allocator;
namespace allocator_traits_detail {
@@ -100,7 +100,7 @@ struct is_std_allocator< std::allocator<T> >
{ static const bool value = true; };
template<class T>
struct is_std_allocator< small_vector_allocator< std::allocator<T> > >
struct is_std_allocator< small_vector_allocator<T, std::allocator<T> > >
{ static const bool value = true; };
template<class Allocator>
@@ -469,6 +469,22 @@ struct allocator_traits
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
};
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template<class T, class AllocatorOrVoid>
struct real_allocator
{
typedef AllocatorOrVoid type;
};
template<class T>
struct real_allocator<T, void>
{
typedef new_allocator<T> type;
};
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
} //namespace container {
} //namespace boost {

View File

@@ -90,6 +90,9 @@ namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template<class T1, class T2>
struct pair;
template<class T>
class new_allocator;
@@ -99,92 +102,83 @@ template <class T
class vector;
template <class T
,class Allocator = new_allocator<T> >
,class Allocator = void >
class stable_vector;
template <class T, std::size_t Capacity>
class static_vector;
template < class T, std::size_t N
, class Allocator= new_allocator<T> >
, class Allocator = void >
class small_vector;
template <class T
,class Allocator = new_allocator<T> >
,class Allocator = void >
class deque;
template <class T
,class Allocator = new_allocator<T> >
,class Allocator = void >
class list;
template <class T
,class Allocator = new_allocator<T> >
,class Allocator = void >
class slist;
template <class Key
,class Compare = std::less<Key>
,class Allocator = new_allocator<Key>
,class Allocator = void
,class Options = void>
class set;
template <class Key
,class Compare = std::less<Key>
,class Allocator = new_allocator<Key>
,class Allocator = void
,class Options = void >
class multiset;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = new_allocator<std::pair<const Key, T> >
,class Allocator = void
,class Options = void >
class map;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = new_allocator<std::pair<const Key, T> >
,class Allocator = void
,class Options = void >
class multimap;
template <class Key
,class Compare = std::less<Key>
,class Allocator = new_allocator<Key> >
,class Allocator = void >
class flat_set;
template <class Key
,class Compare = std::less<Key>
,class Allocator = new_allocator<Key> >
,class Allocator = void >
class flat_multiset;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = new_allocator<std::pair<Key, T> > >
,class Allocator = void >
class flat_map;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = new_allocator<std::pair<Key, T> > >
,class Allocator = void >
class flat_multimap;
template <class CharT
,class Traits = std::char_traits<CharT>
,class Allocator = new_allocator<CharT> >
,class Allocator = void >
class basic_string;
typedef basic_string
<char
,std::char_traits<char>
,new_allocator<char> >
string;
typedef basic_string
<wchar_t
,std::char_traits<wchar_t>
,new_allocator<wchar_t> >
wstring;
typedef basic_string <char> string;
typedef basic_string<wchar_t> wstring;
static const std::size_t ADP_nodes_per_block = 256u;
static const std::size_t ADP_max_free_blocks = 2u;

View File

@@ -483,12 +483,13 @@ template <class T, class Allocator = new_allocator<T> >
#else
template <class T, class Allocator>
#endif
class deque : protected deque_base<Allocator>
class deque : protected deque_base<typename real_allocator<T, Allocator>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef deque_base<Allocator> Base;
typedef deque_base<typename real_allocator<T, Allocator>::type> Base;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename real_allocator<T, Allocator>::type ValAllocator;
public:
@@ -499,13 +500,13 @@ class deque : protected deque_base<Allocator>
//////////////////////////////////////////////
typedef T value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef ValAllocator allocator_type;
typedef typename ::boost::container::allocator_traits<ValAllocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<ValAllocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<ValAllocator>::reference reference;
typedef typename ::boost::container::allocator_traits<ValAllocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<ValAllocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<ValAllocator>::difference_type difference_type;
typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(typename Base::iterator) iterator;
typedef BOOST_CONTAINER_IMPDEF(typename Base::const_iterator) const_iterator;
@@ -519,7 +520,7 @@ class deque : protected deque_base<Allocator>
typedef typename Base::ptr_alloc_ptr index_pointer;
static size_type s_buffer_size()
{ return Base::s_buffer_size(); }
typedef allocator_traits<Allocator> allocator_traits_type;
typedef allocator_traits<ValAllocator> allocator_traits_type;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -535,7 +536,7 @@ class deque : protected deque_base<Allocator>
//! <b>Throws</b>: If allocator_type's default constructor throws.
//!
//! <b>Complexity</b>: Constant.
deque() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
deque() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<ValAllocator>::value)
: Base()
{}
@@ -558,7 +559,7 @@ class deque : protected deque_base<Allocator>
explicit deque(size_type n)
: Base(n, allocator_type())
{
dtl::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
dtl::insert_value_initialized_n_proxy<ValAllocator, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception...
}
@@ -575,7 +576,7 @@ class deque : protected deque_base<Allocator>
deque(size_type n, default_init_t)
: Base(n, allocator_type())
{
dtl::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
dtl::insert_default_initialized_n_proxy<ValAllocator, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception...
}
@@ -590,7 +591,7 @@ class deque : protected deque_base<Allocator>
explicit deque(size_type n, const allocator_type &a)
: Base(n, a)
{
dtl::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
dtl::insert_value_initialized_n_proxy<ValAllocator, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception...
}
@@ -607,7 +608,7 @@ class deque : protected deque_base<Allocator>
deque(size_type n, default_init_t, const allocator_type &a)
: Base(n, a)
{
dtl::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
dtl::insert_default_initialized_n_proxy<ValAllocator, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception...
}
@@ -1096,7 +1097,7 @@ class deque : protected deque_base<Allocator>
this->priv_erase_last_n(len - new_size);
else{
const size_type n = new_size - this->size();
dtl::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
dtl::insert_value_initialized_n_proxy<ValAllocator, iterator> proxy;
priv_insert_back_aux_impl(n, proxy);
}
}
@@ -1116,7 +1117,7 @@ class deque : protected deque_base<Allocator>
this->priv_erase_last_n(len - new_size);
else{
const size_type n = new_size - this->size();
dtl::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
dtl::insert_default_initialized_n_proxy<ValAllocator, iterator> proxy;
priv_insert_back_aux_impl(n, proxy);
}
}
@@ -1366,7 +1367,7 @@ class deque : protected deque_base<Allocator>
return r;
}
else{
typedef dtl::insert_nonmovable_emplace_proxy<Allocator, iterator, Args...> type;
typedef dtl::insert_nonmovable_emplace_proxy<ValAllocator, iterator, Args...> type;
return *this->priv_insert_front_aux_impl(1, type(boost::forward<Args>(args)...));
}
}
@@ -1392,7 +1393,7 @@ class deque : protected deque_base<Allocator>
return r;
}
else{
typedef dtl::insert_nonmovable_emplace_proxy<Allocator, iterator, Args...> type;
typedef dtl::insert_nonmovable_emplace_proxy<ValAllocator, iterator, Args...> type;
return *this->priv_insert_back_aux_impl(1, type(boost::forward<Args>(args)...));
}
}
@@ -1419,7 +1420,7 @@ class deque : protected deque_base<Allocator>
return (this->end()-1);
}
else{
typedef dtl::insert_emplace_proxy<Allocator, iterator, Args...> type;
typedef dtl::insert_emplace_proxy<ValAllocator, iterator, Args...> type;
return this->priv_insert_aux_impl(p, 1, type(boost::forward<Args>(args)...));
}
}
@@ -1439,7 +1440,7 @@ class deque : protected deque_base<Allocator>
}\
else{\
typedef dtl::insert_nonmovable_emplace_proxy##N\
<Allocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
<ValAllocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
return *priv_insert_front_aux_impl(1, type(BOOST_MOVE_FWD##N));\
}\
}\
@@ -1456,7 +1457,7 @@ class deque : protected deque_base<Allocator>
}\
else{\
typedef dtl::insert_nonmovable_emplace_proxy##N\
<Allocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
<ValAllocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
return *priv_insert_back_aux_impl(1, type(BOOST_MOVE_FWD##N));\
}\
}\
@@ -1475,7 +1476,7 @@ class deque : protected deque_base<Allocator>
}\
else{\
typedef dtl::insert_emplace_proxy_arg##N\
<Allocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
<ValAllocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\
return this->priv_insert_aux_impl(p, 1, type(BOOST_MOVE_FWD##N));\
}\
}
@@ -1633,7 +1634,7 @@ class deque : protected deque_base<Allocator>
)
{
BOOST_ASSERT(this->priv_in_range_or_end(p));
dtl::insert_range_proxy<Allocator, FwdIt, iterator> proxy(first);
dtl::insert_range_proxy<ValAllocator, FwdIt, iterator> proxy(first);
return priv_insert_aux_impl(p, boost::container::iterator_distance(first, last), proxy);
}
#endif
@@ -1874,7 +1875,7 @@ class deque : protected deque_base<Allocator>
else {
return priv_insert_aux_impl
( p, (size_type)1
, dtl::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
, dtl::get_insert_value_proxy<iterator, ValAllocator>(::boost::forward<U>(x)));
}
}
@@ -1889,7 +1890,7 @@ class deque : protected deque_base<Allocator>
else{
priv_insert_aux_impl
( this->cbegin(), (size_type)1
, dtl::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
, dtl::get_insert_value_proxy<iterator, ValAllocator>(::boost::forward<U>(x)));
}
}
@@ -1904,7 +1905,7 @@ class deque : protected deque_base<Allocator>
else{
priv_insert_aux_impl
( this->cend(), (size_type)1
, dtl::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
, dtl::get_insert_value_proxy<iterator, ValAllocator>(::boost::forward<U>(x)));
}
}

View File

@@ -24,10 +24,10 @@
namespace boost {
namespace container {
template<class Allocator>
template<class ValueType>
class equal_to_value
{
typedef typename Allocator::value_type value_type;
typedef ValueType value_type;
const value_type &t_;
public:

View File

@@ -34,7 +34,11 @@ struct container_or_allocator_rebind_impl
template<class AllocatorOrContainer, class ToType>
struct container_or_allocator_rebind_impl<AllocatorOrContainer, ToType, false>
: allocator_traits<AllocatorOrContainer>::template portable_rebind_alloc<ToType>
{};
template<class ToType>
struct container_or_allocator_rebind_impl<void, ToType, false>
: real_allocator<ToType, void>
{};
template<class AllocatorOrContainer, class ToType>

View File

@@ -427,13 +427,15 @@ class flat_tree_value_compare
{ return *this; }
};
///////////////////////////////////////
//
// select_container_type
//
///////////////////////////////////////
template < class Value, class AllocatorOrContainer
, bool = boost::container::dtl::is_container<AllocatorOrContainer>::value >
, bool = boost::container::dtl::is_container<AllocatorOrContainer>::value
>
struct select_container_type
{
typedef AllocatorOrContainer type;
@@ -442,7 +444,7 @@ struct select_container_type
template <class Value, class AllocatorOrContainer>
struct select_container_type<Value, AllocatorOrContainer, false>
{
typedef boost::container::vector<Value, AllocatorOrContainer> type;
typedef boost::container::vector<Value, typename real_allocator<Value, AllocatorOrContainer>::type> type;
};

View File

@@ -48,6 +48,13 @@ struct is_container
has_member_function_callable_with_empty<const Container>::value;
};
template <>
struct is_container<void>
{
static const bool value = false;
};
} //namespace dtl {
} //namespace container {
} //namespace boost {

View File

@@ -484,32 +484,65 @@ struct get_tree_opt<void>
typedef tree_assoc_defaults type;
};
template<class, class KeyOfValue>
struct real_key_of_value
{
typedef KeyOfValue type;
};
template<class T>
struct real_key_of_value<T, void>
{
typedef dtl::identity<T> type;
};
template<class T1, class T2>
struct real_key_of_value<std::pair<T1, T2>, int>
{
typedef dtl::select1st<T1> type;
};
template<class T1, class T2>
struct real_key_of_value<boost::container::pair<T1, T2>, int>
{
typedef dtl::select1st<T1> type;
};
template <class T, class KeyOfValue, class Compare, class Allocator, class Options>
class tree
: public dtl::node_alloc_holder
< Allocator
< typename real_allocator<T, Allocator>::type
, typename dtl::intrusive_tree_type
< Allocator, tree_value_compare
<typename allocator_traits<Allocator>::pointer, Compare, KeyOfValue>
< typename real_allocator<T, Allocator>::type
, tree_value_compare
<typename allocator_traits<typename real_allocator<T, Allocator>::type>::pointer, Compare, typename real_key_of_value<T, KeyOfValue>::type>
, get_tree_opt<Options>::type::tree_type
, get_tree_opt<Options>::type::optimize_size
>::type
>
{
typedef tree < T, KeyOfValue
, Compare, Allocator, Options> ThisType;
public:
typedef typename real_allocator<T, Allocator>::type allocator_type;
private:
typedef allocator_traits<allocator_type> allocator_traits_t;
typedef typename real_key_of_value<T, KeyOfValue>::type key_of_value_t;
typedef tree_value_compare
< typename allocator_traits<Allocator>::pointer
, Compare, KeyOfValue> ValComp;
< typename allocator_traits_t::pointer
, Compare
, key_of_value_t> ValComp;
typedef typename get_tree_opt<Options>::type options_type;
typedef typename dtl::intrusive_tree_type
< Allocator, ValComp
< allocator_type, ValComp
, options_type::tree_type
, options_type::optimize_size
>::type Icont;
typedef dtl::node_alloc_holder
<Allocator, Icont> AllocHolder;
<allocator_type, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef tree < T, KeyOfValue
, Compare, Allocator, Options> ThisType;
typedef typename AllocHolder::NodeAlloc NodeAlloc;
typedef boost::container::
allocator_traits<NodeAlloc> allocator_traits_type;
@@ -525,23 +558,22 @@ class tree
public:
typedef typename KeyOfValue::type key_type;
typedef typename key_of_value_t::type key_type;
typedef T value_type;
typedef Allocator allocator_type;
typedef Compare key_compare;
typedef ValComp value_compare;
typedef typename boost::container::
allocator_traits<Allocator>::pointer pointer;
allocator_traits<allocator_type>::pointer pointer;
typedef typename boost::container::
allocator_traits<Allocator>::const_pointer const_pointer;
allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename boost::container::
allocator_traits<Allocator>::reference reference;
allocator_traits<allocator_type>::reference reference;
typedef typename boost::container::
allocator_traits<Allocator>::const_reference const_reference;
allocator_traits<allocator_type>::const_reference const_reference;
typedef typename boost::container::
allocator_traits<Allocator>::size_type size_type;
allocator_traits<allocator_type>::size_type size_type;
typedef typename boost::container::
allocator_traits<Allocator>::difference_type difference_type;
allocator_traits<allocator_type>::difference_type difference_type;
typedef dtl::iterator_from_iiterator
<iiterator, false> iterator;
typedef dtl::iterator_from_iiterator
@@ -559,7 +591,7 @@ class tree
private:
typedef key_node_compare<key_compare, KeyOfValue> KeyNodeCompare;
typedef key_node_compare<key_compare, key_of_value_t> KeyNodeCompare;
public:
@@ -955,7 +987,7 @@ class tree
{
insert_commit_data data;
std::pair<iterator,bool> ret =
this->insert_unique_check(KeyOfValue()(v), data);
this->insert_unique_check(key_of_value_t()(v), data);
if(ret.second){
ret.first = this->insert_unique_commit(boost::forward<MovableConvertible>(v), data);
}
@@ -998,7 +1030,7 @@ class tree
insert_commit_data data;
scoped_destroy_deallocator<NodeAlloc> destroy_deallocator(p, this->node_alloc());
std::pair<iterator,bool> ret =
this->insert_unique_check(KeyOfValue()(v), data);
this->insert_unique_check(key_of_value_t()(v), data);
if(!ret.second){
return ret;
}
@@ -1015,7 +1047,7 @@ class tree
value_type &v = p->get_data();
insert_commit_data data;
std::pair<iterator,bool> ret =
this->insert_unique_check(hint, KeyOfValue()(v), data);
this->insert_unique_check(hint, key_of_value_t()(v), data);
if(!ret.second){
Destroyer(this->node_alloc())(p);
return ret.first;
@@ -1131,7 +1163,7 @@ class tree
BOOST_ASSERT((priv_is_linked)(hint));
insert_commit_data data;
std::pair<iterator,bool> ret =
this->insert_unique_check(hint, KeyOfValue()(v), data);
this->insert_unique_check(hint, key_of_value_t()(v), data);
if(!ret.second)
return ret.first;
return this->insert_unique_commit(boost::forward<MovableConvertible>(v), data);
@@ -1246,7 +1278,7 @@ class tree
if(!nh.empty()){
insert_commit_data data;
std::pair<iterator,bool> ret =
this->insert_unique_check(hint, KeyOfValue()(nh.value()), data);
this->insert_unique_check(hint, key_of_value_t()(nh.value()), data);
if(ret.second){
irt.inserted = true;
irt.position = iterator(this->icont().insert_unique_commit(*nh.get(), data));

View File

@@ -195,7 +195,7 @@ class flat_map
typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type;
//AllocatorOrContainer::value_type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, typename allocator_type::value_type>::value));
BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, value_type>::value));
//////////////////////////////////////////////
//
@@ -1773,7 +1773,7 @@ class flat_multimap
typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type;
//AllocatorOrContainer::value_type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, typename AllocatorOrContainer::value_type>::value));
BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, value_type>::value));
//////////////////////////////////////////////
//

View File

@@ -162,28 +162,32 @@ struct intrusive_list_type
//! or mutation is explicit.
//!
//! \tparam T The type of object that is stored in the list
//! \tparam Allocator The allocator used for all internal memory management
//! \tparam Allocator The allocator used for all internal memory management, use void
//! for the default allocator
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = new_allocator<T> >
template <class T, class Allocator = void >
#else
template <class T, class Allocator>
#endif
class list
: protected dtl::node_alloc_holder
<Allocator, typename dtl::intrusive_list_type<Allocator>::type>
< typename real_allocator<T, Allocator>::type
, typename dtl::intrusive_list_type<typename real_allocator<T, Allocator>::type>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename real_allocator<T, Allocator>::type ValueAllocator;
typedef typename
dtl::intrusive_list_type<Allocator>::type Icont;
typedef dtl::node_alloc_holder<Allocator, Icont> AllocHolder;
dtl::intrusive_list_type<ValueAllocator>::type Icont;
typedef dtl::node_alloc_holder<ValueAllocator, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef typename AllocHolder::NodeAlloc NodeAlloc;
typedef typename AllocHolder::ValAlloc ValAlloc;
typedef typename AllocHolder::Node Node;
typedef dtl::allocator_destroyer<NodeAlloc> Destroyer;
typedef typename AllocHolder::alloc_version alloc_version;
typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::equal_to_value<Allocator> equal_to_value_type;
typedef boost::container::allocator_traits<ValueAllocator> allocator_traits_type;
typedef boost::container::equal_to_value
<typename allocator_traits_type::value_type> equal_to_value_type;
BOOST_COPYABLE_AND_MOVABLE(list)
@@ -199,13 +203,13 @@ class list
//////////////////////////////////////////////
typedef T value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::reference reference;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::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;
@@ -223,7 +227,7 @@ class list
//! <b>Throws</b>: If allocator_type's default constructor throws.
//!
//! <b>Complexity</b>: Constant.
list() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
list() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<ValueAllocator>::value)
: AllocHolder()
{}
@@ -244,7 +248,7 @@ class list
//!
//! <b>Complexity</b>: Linear to n.
explicit list(size_type n)
: AllocHolder(Allocator())
: AllocHolder(ValueAllocator())
{ this->resize(n); }
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
@@ -265,7 +269,7 @@ class list
//! throws or T's default or copy constructor throws.
//!
//! <b>Complexity</b>: Linear to n.
list(size_type n, const T& value, const Allocator& a = Allocator())
list(size_type n, const T& value, const ValueAllocator& a = ValueAllocator())
: AllocHolder(a)
{ this->insert(this->cbegin(), n, value); }
@@ -325,7 +329,7 @@ class list
//!
//! <b>Complexity</b>: Linear to the range [first, last).
template <class InpIt>
list(InpIt first, InpIt last, const Allocator &a = Allocator())
list(InpIt first, InpIt last, const ValueAllocator &a = ValueAllocator())
: AllocHolder(a)
{ this->insert(this->cbegin(), first, last); }
@@ -339,7 +343,7 @@ class list
//! std::initializer_list iterator throws.
//!
//! <b>Complexity</b>: Linear to the range [il.begin(), il.end()).
list(std::initializer_list<value_type> il, const Allocator &a = Allocator())
list(std::initializer_list<value_type> il, const ValueAllocator &a = ValueAllocator())
: AllocHolder(a)
{ this->insert(this->cbegin(), il.begin(), il.end()); }
#endif
@@ -1503,9 +1507,9 @@ template <typename InputIterator>
list(InputIterator, InputIterator) ->
list<typename iterator_traits<InputIterator>::value_type>;
template <typename InputIterator, typename Allocator>
list(InputIterator, InputIterator, Allocator const&) ->
list<typename iterator_traits<InputIterator>::value_type, Allocator>;
template <typename InputIterator, typename ValueAllocator>
list(InputIterator, InputIterator, ValueAllocator const&) ->
list<typename iterator_traits<InputIterator>::value_type, ValueAllocator>;
#endif
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -72,7 +72,7 @@ namespace container {
//! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
//! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options.
template < class Key, class T, class Compare = std::less<Key>
, class Allocator = new_allocator< std::pair< const Key, T> >, class Options = tree_assoc_defaults >
, class Allocator = void, class Options = tree_assoc_defaults >
#else
template <class Key, class T, class Compare, class Allocator, class Options>
#endif
@@ -80,7 +80,7 @@ class map
///@cond
: public dtl::tree
< std::pair<const Key, T>
, dtl::select1st<Key>
, int
, Compare, Allocator, Options>
///@endcond
{
@@ -88,7 +88,7 @@ class map
private:
BOOST_COPYABLE_AND_MOVABLE(map)
typedef dtl::select1st<Key> select_1st_t;
typedef int select_1st_t;
typedef std::pair<const Key, T> value_type_impl;
typedef dtl::tree
<value_type_impl, select_1st_t, Compare, Allocator, Options> base_t;
@@ -104,16 +104,16 @@ class map
//////////////////////////////////////////////
typedef Key key_type;
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef T mapped_type;
typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<Allocator>::reference reference;
typedef typename boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename base_t::allocator_type allocator_type;
typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
typedef typename boost::container::allocator_traits<allocator_type>::value_type value_type;
typedef typename boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef typename boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<allocator_type>::reference reference;
typedef typename boost::container::allocator_traits<allocator_type>::const_reference const_reference;
typedef typename boost::container::allocator_traits<allocator_type>::size_type size_type;
typedef typename boost::container::allocator_traits<allocator_type>::difference_type difference_type;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
typedef Compare key_compare;
@@ -143,7 +143,7 @@ class map
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE
map() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value &&
map() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value &&
dtl::is_nothrow_default_constructible<Compare>::value)
: base_t()
{}
@@ -1405,7 +1405,7 @@ class multimap
///@cond
: public dtl::tree
< std::pair<const Key, T>
, dtl::select1st<Key>
, int
, Compare, Allocator, Options>
///@endcond
{
@@ -1413,7 +1413,7 @@ class multimap
private:
BOOST_COPYABLE_AND_MOVABLE(multimap)
typedef dtl::select1st<Key> select_1st_t;
typedef int select_1st_t;
typedef std::pair<const Key, T> value_type_impl;
typedef dtl::tree
<value_type_impl, select_1st_t, Compare, Allocator, Options> base_t;
@@ -1421,8 +1421,6 @@ class multimap
typedef typename base_t::value_compare value_compare_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
public:
//////////////////////////////////////////////
//
@@ -1432,14 +1430,15 @@ class multimap
typedef Key key_type;
typedef T mapped_type;
typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<Allocator>::reference reference;
typedef typename boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename base_t::allocator_type allocator_type;
typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
typedef typename boost::container::allocator_traits<allocator_type>::value_type value_type;
typedef typename boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef typename boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<allocator_type>::reference reference;
typedef typename boost::container::allocator_traits<allocator_type>::const_reference const_reference;
typedef typename boost::container::allocator_traits<allocator_type>::size_type size_type;
typedef typename boost::container::allocator_traits<allocator_type>::difference_type difference_type;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
typedef Compare key_compare;
@@ -1467,7 +1466,7 @@ class multimap
//!
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE multimap()
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value &&
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value &&
dtl::is_nothrow_default_constructible<Compare>::value)
: base_t()
{}

View File

@@ -67,14 +67,14 @@ template <class Key, class Compare, class Allocator, class Options>
class set
///@cond
: public dtl::tree
< Key, dtl::identity<Key>, Compare, Allocator, Options>
< Key, void, Compare, Allocator, Options>
///@endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(set)
typedef dtl::tree
< Key, dtl::identity<Key>, Compare, Allocator, Options> base_t;
< Key, void, Compare, Allocator, Options> base_t;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -86,15 +86,15 @@ class set
typedef Key key_type;
typedef Key value_type;
typedef Compare key_compare;
typedef Compare value_compare;
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef key_compare value_compare;
typedef typename base_t::allocator_type allocator_type;
typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::reference reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::size_type size_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::difference_type difference_type;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
@@ -114,7 +114,7 @@ class set
//! <b>Complexity</b>: Constant.
BOOST_CONTAINER_FORCEINLINE set()
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value &&
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value &&
dtl::is_nothrow_default_constructible<Compare>::value)
: base_t()
{}
@@ -655,7 +655,7 @@ class set
BOOST_CONTAINER_FORCEINLINE void merge(set<Key, C2, Allocator, Options>& source)
{
typedef dtl::tree
<Key, dtl::identity<Key>, C2, Allocator, Options> base2_t;
<Key, void, C2, Allocator, Options> base2_t;
this->base_t::merge_unique(static_cast<base2_t&>(source));
}
@@ -669,7 +669,7 @@ class set
BOOST_CONTAINER_FORCEINLINE void merge(multiset<Key, C2, Allocator, Options>& source)
{
typedef dtl::tree
<Key, dtl::identity<Key>, C2, Allocator, Options> base2_t;
<Key, void, C2, Allocator, Options> base2_t;
this->base_t::merge_unique(static_cast<base2_t&>(source));
}
@@ -1058,14 +1058,14 @@ template <class Key, class Compare, class Allocator, class Options>
class multiset
/// @cond
: public dtl::tree
<Key,dtl::identity<Key>, Compare, Allocator, Options>
<Key, void, Compare, Allocator, Options>
/// @endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(multiset)
typedef dtl::tree
<Key,dtl::identity<Key>, Compare, Allocator, Options> base_t;
<Key, void, Compare, Allocator, Options> base_t;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -1078,15 +1078,15 @@ class multiset
typedef Key key_type;
typedef Key value_type;
typedef Compare key_compare;
typedef Compare value_compare;
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef key_compare value_compare;
typedef typename base_t::allocator_type allocator_type;
typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::reference reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::size_type size_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::difference_type difference_type;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::stored_allocator_type) stored_allocator_type;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::iterator) iterator;
typedef typename BOOST_CONTAINER_IMPDEF(base_t::const_iterator) const_iterator;
@@ -1102,7 +1102,7 @@ class multiset
//! @copydoc ::boost::container::set::set()
BOOST_CONTAINER_FORCEINLINE multiset()
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value &&
BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value &&
dtl::is_nothrow_default_constructible<Compare>::value)
: base_t()
{}
@@ -1448,7 +1448,7 @@ class multiset
BOOST_CONTAINER_FORCEINLINE void merge(multiset<Key, C2, Allocator, Options>& source)
{
typedef dtl::tree
<Key, dtl::identity<Key>, C2, Allocator, Options> base2_t;
<Key, void, C2, Allocator, Options> base2_t;
this->base_t::merge_equal(static_cast<base2_t&>(source));
}
@@ -1462,7 +1462,7 @@ class multiset
BOOST_CONTAINER_FORCEINLINE void merge(set<Key, C2, Allocator, Options>& source)
{
typedef dtl::tree
<Key, dtl::identity<Key>, C2, Allocator, Options> base2_t;
<Key, void, C2, Allocator, Options> base2_t;
this->base_t::merge_equal(static_cast<base2_t&>(source));
}

View File

@@ -192,20 +192,23 @@ struct intrusive_slist_type
//! then you should probably use list instead of slist.
//!
//! \tparam T The type of object that is stored in the list
//! \tparam Allocator The allocator used for all internal memory management
//! \tparam Allocator The allocator used for all internal memory management, use void
//! for the default allocator
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = new_allocator<T> >
template <class T, class Allocator = void >
#else
template <class T, class Allocator>
#endif
class slist
: protected dtl::node_alloc_holder
<Allocator, typename dtl::intrusive_slist_type<Allocator>::type>
< typename real_allocator<T, Allocator>::type
, typename dtl::intrusive_slist_type<typename real_allocator<T, Allocator>::type>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename real_allocator<T, Allocator>::type ValueAllocator;
typedef typename
dtl::intrusive_slist_type<Allocator>::type Icont;
typedef dtl::node_alloc_holder<Allocator, Icont> AllocHolder;
dtl::intrusive_slist_type<ValueAllocator>::type Icont;
typedef dtl::node_alloc_holder<ValueAllocator, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef typename AllocHolder::NodeAlloc NodeAlloc;
typedef typename AllocHolder::ValAlloc ValAlloc;
@@ -213,8 +216,9 @@ class slist
typedef dtl::allocator_destroyer<NodeAlloc> Destroyer;
typedef typename AllocHolder::alloc_version alloc_version;
typedef boost::container::
allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::equal_to_value<Allocator> equal_to_value_type;
allocator_traits<ValueAllocator> allocator_traits_type;
typedef boost::container::equal_to_value
<typename allocator_traits_type::value_type> equal_to_value_type;
BOOST_COPYABLE_AND_MOVABLE(slist)
typedef dtl::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl;
@@ -229,13 +233,13 @@ class slist
//////////////////////////////////////////////
typedef T value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::reference reference;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::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;
@@ -253,7 +257,7 @@ class slist
//! <b>Throws</b>: If allocator_type's copy constructor throws.
//!
//! <b>Complexity</b>: Constant.
slist() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
slist() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<ValueAllocator>::value)
: AllocHolder()
{}
@@ -1710,11 +1714,11 @@ BOOST_CONTAINER_DOC1ST(namespace std {, BOOST_MOVE_STD_NS_BEG)
//! A specialization of insert_iterator
//! that works with slist
template <class T, class Allocator>
class insert_iterator<boost::container::slist<T, Allocator> >
template <class T, class ValueAllocator>
class insert_iterator<boost::container::slist<T, ValueAllocator> >
{
private:
typedef boost::container::slist<T, Allocator> Container;
typedef boost::container::slist<T, ValueAllocator> Container;
Container* container;
typename Container::iterator iter;

View File

@@ -50,7 +50,7 @@ namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = new_allocator<T> >
template <class T, class Allocator = void >
class small_vector_base;
#endif
@@ -78,45 +78,47 @@ class small_vector_base;
//! is being used to store vector elements.
//!
//! `small_vector_allocator` assumes that will be instantiated as
//! `boost::container::vector< T, small_vector_allocator<Allocator> >`
//! `boost::container::vector< T, small_vector_allocator<T, Allocator> >`
//! and internal storage can be obtained downcasting that vector
//! to `small_vector_base<T>`.
template<class Allocator>
template<class T, class VoidAllocator>
class small_vector_allocator
: public Allocator
: public allocator_traits<typename real_allocator<T, VoidAllocator>::type>::template portable_rebind_alloc<T>::type
{
typedef unsigned int allocation_type;
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef typename allocator_traits<typename real_allocator<T, VoidAllocator>::type>::template portable_rebind_alloc<T>::type allocator_type;
BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator)
BOOST_CONTAINER_FORCEINLINE const Allocator &as_base() const
{ return static_cast<const Allocator&>(*this); }
BOOST_CONTAINER_FORCEINLINE const allocator_type &as_base() const
{ return static_cast<const allocator_type&>(*this); }
BOOST_CONTAINER_FORCEINLINE Allocator &as_base()
{ return static_cast<Allocator&>(*this); }
BOOST_CONTAINER_FORCEINLINE allocator_type &as_base()
{ return static_cast<allocator_type&>(*this); }
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef allocator_traits<Allocator> allocator_traits_type;
typedef allocator_traits<allocator_type> allocator_traits_type;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename allocator_traits<Allocator>::value_type value_type;
typedef typename allocator_traits<Allocator>::pointer pointer;
typedef typename allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename allocator_traits<Allocator>::reference reference;
typedef typename allocator_traits<Allocator>::const_reference const_reference;
typedef typename allocator_traits<Allocator>::size_type size_type;
typedef typename allocator_traits<Allocator>::difference_type difference_type;
typedef typename allocator_traits<Allocator>::void_pointer void_pointer;
typedef typename allocator_traits<Allocator>::const_void_pointer const_void_pointer;
typedef typename allocator_traits<allocator_type>::value_type value_type;
typedef typename allocator_traits<allocator_type>::pointer pointer;
typedef typename allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename allocator_traits<allocator_type>::reference reference;
typedef typename allocator_traits<allocator_type>::const_reference const_reference;
typedef typename allocator_traits<allocator_type>::size_type size_type;
typedef typename allocator_traits<allocator_type>::difference_type difference_type;
typedef typename allocator_traits<allocator_type>::void_pointer void_pointer;
typedef typename allocator_traits<allocator_type>::const_void_pointer const_void_pointer;
typedef typename allocator_traits<Allocator>::propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
typedef typename allocator_traits<Allocator>::propagate_on_container_move_assignment propagate_on_container_move_assignment;
typedef typename allocator_traits<Allocator>::propagate_on_container_swap propagate_on_container_swap;
typedef typename allocator_traits<allocator_type>::propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
typedef typename allocator_traits<allocator_type>::propagate_on_container_move_assignment propagate_on_container_move_assignment;
typedef typename allocator_traits<allocator_type>::propagate_on_container_swap propagate_on_container_swap;
//! An integral constant with member `value == false`
typedef BOOST_CONTAINER_IMPDEF(dtl::bool_<false>) is_always_equal;
//! An integral constant with member `value == true`
@@ -129,20 +131,20 @@ class small_vector_allocator
template<class T2>
struct rebind
{
typedef typename allocator_traits<Allocator>::template rebind_alloc<T2>::type other;
typedef typename allocator_traits<allocator_type>::template portable_rebind_alloc<T2>::type other;
};
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//!Constructor from arbitrary arguments
template<class ...Args>
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args)
: Allocator(::boost::forward<Args>(args)...)
: allocator_type(::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 \
BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\
: Allocator(BOOST_MOVE_FWD##N)\
: allocator_type(BOOST_MOVE_FWD##N)\
{}\
//
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE)
@@ -153,57 +155,57 @@ class small_vector_allocator
//!Never throws
BOOST_CONTAINER_FORCEINLINE small_vector_allocator
(const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(other.as_base())
: allocator_type(other.as_base())
{}
//!Move constructor from small_vector_allocator.
//!Never throws
BOOST_CONTAINER_FORCEINLINE small_vector_allocator
(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(::boost::move(other.as_base()))
: allocator_type(::boost::move(other.as_base()))
{}
//!Constructor from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
template<class U, class OtherVoidAllocator>
BOOST_CONTAINER_FORCEINLINE small_vector_allocator
(const small_vector_allocator<OtherAllocator> &other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(other.as_base())
(const small_vector_allocator<U, OtherVoidAllocator> &other) BOOST_NOEXCEPT_OR_NOTHROW
: allocator_type(other.as_base())
{}
//!Move constructor from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
template<class U, class OtherVoidAllocator>
BOOST_CONTAINER_FORCEINLINE small_vector_allocator
(BOOST_RV_REF(small_vector_allocator<OtherAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
: Allocator(::boost::move(other.as_base()))
(BOOST_RV_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
: allocator_type(::boost::move(other.as_base()))
{}
//!Assignment from other small_vector_allocator.
//!Never throws
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())); }
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(other.as_base())); }
//!Move constructor from other small_vector_allocator.
//!Never throws
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()))); }
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(::boost::move(other.as_base()))); }
//!Assignment from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
template<class U, class OtherVoidAllocator>
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())); }
operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(other.as_base())); }
//!Move assignment from related small_vector_allocator.
//!Never throws
template<class OtherAllocator>
template<class U, class OtherVoidAllocator>
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()))); }
operator=(BOOST_RV_REF(small_vector_allocator<U BOOST_MOVE_I OtherVoidAllocator>) other) BOOST_NOEXCEPT_OR_NOTHROW
{ return static_cast<small_vector_allocator&>(this->allocator_type::operator=(::boost::move(other.as_base()))); }
//!Allocates storage from the standard-conforming allocator
BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer())
@@ -269,12 +271,16 @@ class small_vector_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
using Allocator::allocate_one;
using Allocator::allocate_individual;
using Allocator::deallocate_one;
using Allocator::deallocate_individual;
using Allocator::allocate_many;
using Allocator::deallocate_many;*/
using allocator_type::allocate_one;
using allocator_type::allocate_individual;
using allocator_type::deallocate_one;
using allocator_type::deallocate_individual;
using allocator_type::allocate_many;
using allocator_type::deallocate_many;*/
typedef vector_alloc_holder< small_vector_allocator, size_type > vector_alloc_holder_t;
typedef vector<value_type, small_vector_allocator> vector_base;
typedef small_vector_base<value_type, allocator_type> derived_type;
BOOST_CONTAINER_FORCEINLINE bool is_internal_storage(const_pointer p) const
{ return this->internal_storage() == p; }
@@ -282,12 +288,6 @@ class small_vector_allocator
BOOST_CONTAINER_FORCEINLINE
const_pointer internal_storage() const
{
typedef typename Allocator::value_type value_type;
typedef typename allocator_traits_type::size_type size_type;
typedef vector_alloc_holder< small_vector_allocator<Allocator>, size_type > vector_alloc_holder_t;
typedef vector<value_type, small_vector_allocator<Allocator> > vector_base;
typedef small_vector_base<value_type, Allocator> derived_type;
//
const vector_alloc_holder_t &v_holder = static_cast<const vector_alloc_holder_t &>(*this);
const vector_base &v_base = reinterpret_cast<const vector_base &>(v_holder);
const derived_type &d_base = static_cast<const derived_type &>(v_base);
@@ -297,12 +297,6 @@ class small_vector_allocator
BOOST_CONTAINER_FORCEINLINE
pointer internal_storage()
{
typedef typename Allocator::value_type value_type;
typedef typename allocator_traits_type::size_type size_type;
typedef vector_alloc_holder< small_vector_allocator<Allocator>, size_type > vector_alloc_holder_t;
typedef vector<value_type, small_vector_allocator<Allocator> > vector_base;
typedef small_vector_base<value_type, Allocator> derived_type;
//
vector_alloc_holder_t &v_holder = static_cast<vector_alloc_holder_t &>(*this);
vector_base &v_base = reinterpret_cast<vector_base &>(v_holder);
derived_type &d_base = static_cast<derived_type &>(v_base);
@@ -338,21 +332,31 @@ class small_vector_allocator
//!
template <class T, class SecondaryAllocator>
class small_vector_base
: public vector<T, small_vector_allocator<SecondaryAllocator> >
: public vector
< T
, small_vector_allocator
< T
, typename allocator_traits<typename real_allocator<T, SecondaryAllocator>::type>::template portable_rebind_alloc<void>::type
>
>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKEDVECTOR
public:
//Make it public as it will be inherited by small_vector and container
//must have this public member
typedef typename allocator_traits<SecondaryAllocator>::pointer pointer;
typedef typename allocator_traits<SecondaryAllocator>::const_pointer const_pointer;
typedef typename allocator_traits<SecondaryAllocator>::void_pointer void_pointer;
typedef typename allocator_traits<SecondaryAllocator>::const_void_pointer const_void_pointer;
typedef typename real_allocator<T, SecondaryAllocator>::type secondary_allocator_t;
typedef typename allocator_traits<secondary_allocator_t>::template portable_rebind_alloc<void>::type void_allocator_t;
typedef vector<T, small_vector_allocator<T, void_allocator_t> > base_type;
typedef typename allocator_traits<secondary_allocator_t>::pointer pointer;
typedef typename allocator_traits<secondary_allocator_t>::const_pointer const_pointer;
typedef typename allocator_traits<secondary_allocator_t>::void_pointer void_pointer;
typedef typename allocator_traits<secondary_allocator_t>::const_void_pointer const_void_pointer;
typedef small_vector_allocator<T, void_allocator_t> allocator_type;
private:
BOOST_COPYABLE_AND_MOVABLE(small_vector_base)
friend class small_vector_allocator<SecondaryAllocator>;
friend class small_vector_allocator<T, void_allocator_t>;
BOOST_CONTAINER_FORCEINLINE
const_pointer internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW
@@ -374,14 +378,12 @@ class small_vector_base
return boost::intrusive::pointer_traits<pointer>::static_cast_from(void_p);
}
typedef vector<T, small_vector_allocator<SecondaryAllocator> > base_type;
base_type &as_base() { return static_cast<base_type&>(*this); }
const base_type &as_base() const { return static_cast<const base_type&>(*this); }
public:
typedef typename dtl::aligned_storage
<sizeof(T), dtl::alignment_of<T>::value>::type storage_type;
typedef small_vector_allocator<SecondaryAllocator> allocator_type;
protected:
@@ -451,7 +453,9 @@ template<class Storage, class Allocator, class T, std::size_t N>
struct small_vector_storage_calculator
{
typedef small_vector_base<T, Allocator> svh_type;
typedef vector<T, small_vector_allocator<Allocator> > svhb_type;
typedef typename real_allocator<T, Allocator>::type value_allocator_t;
typedef typename allocator_traits<value_allocator_t>::template portable_rebind_alloc<void>::type void_allocator_t;
typedef vector<T, small_vector_allocator<T, void_allocator_t> > svhb_type;
static const std::size_t s_align = dtl::alignment_of<Storage>::value;
static const std::size_t s_size = sizeof(Storage);
static const std::size_t svh_sizeof = sizeof(svh_type);
@@ -478,10 +482,10 @@ template<class Storage>
struct small_vector_storage<Storage, 0>
{};
template<class Allocator, std::size_t N>
template<class T, class Allocator, std::size_t N>
struct small_vector_storage_definer
{
typedef typename Allocator::value_type value_type;
typedef T value_type;
typedef typename small_vector_base<value_type, Allocator>::storage_type storage_type;
static const std::size_t needed_extra_storages =
small_vector_storage_calculator<storage_type, Allocator, value_type, N>::needed_extra_storages;
@@ -501,16 +505,17 @@ struct small_vector_storage_definer
//!
//! \tparam T The type of object that is stored in the small_vector
//! \tparam N The number of preallocated elements stored inside small_vector. It shall be less than Allocator::max_size();
//! \tparam Allocator The allocator used for memory management when the number of elements exceeds N.
template <class T, std::size_t N, class Allocator BOOST_CONTAINER_DOCONLY(= new_allocator<T>) >
//! \tparam Allocator The allocator used for memory management when the number of elements exceeds N. Use void
//! for the default allocator
template <class T, std::size_t N, class Allocator BOOST_CONTAINER_DOCONLY(= void) >
class small_vector : public small_vector_base<T, Allocator>
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
, private small_vector_storage_definer<Allocator, N>::type
, private small_vector_storage_definer<T, Allocator, N>::type
#endif
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef small_vector_base<T, Allocator> base_type;
typedef typename small_vector_storage_definer<Allocator, N>::type remaining_storage_holder;
typedef typename small_vector_storage_definer<T, Allocator, N>::type remaining_storage_holder;
BOOST_COPYABLE_AND_MOVABLE(small_vector)

View File

@@ -465,14 +465,15 @@ class stable_vector_iterator
//! \tparam T The type of object that is stored in the stable_vector
//! \tparam Allocator The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = new_allocator<T> >
template <class T, class Allocator = void >
#else
template <class T, class Allocator>
#endif
class stable_vector
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef allocator_traits<Allocator> allocator_traits_type;
typedef typename real_allocator<T, Allocator>::type ValueAllocator;
typedef allocator_traits<ValueAllocator> allocator_traits_type;
typedef boost::intrusive::
pointer_traits
<typename allocator_traits_type::pointer> ptr_traits;
@@ -510,7 +511,7 @@ class stable_vector
typedef ::boost::container::dtl::integral_constant
<unsigned, boost::container::dtl::
version<Allocator>::value> alloc_version;
version<ValueAllocator>::value> alloc_version;
typedef typename allocator_traits_type::
template portable_rebind_alloc
<node_type>::type node_allocator_type;
@@ -533,10 +534,10 @@ class stable_vector
friend class stable_vector_detail::clear_on_destroy<stable_vector>;
typedef stable_vector_iterator
< typename allocator_traits<Allocator>::pointer
< typename allocator_traits<ValueAllocator>::pointer
, false> iterator_impl;
typedef stable_vector_iterator
< typename allocator_traits<Allocator>::pointer
< typename allocator_traits<ValueAllocator>::pointer
, true> const_iterator_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -547,13 +548,13 @@ class stable_vector
//
//////////////////////////////////////////////
typedef T value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::reference reference;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<ValueAllocator>::difference_type difference_type;
typedef ValueAllocator allocator_type;
typedef node_allocator_type stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator;
@@ -584,7 +585,7 @@ class stable_vector
//! <b>Throws</b>: If allocator_type's default constructor throws.
//!
//! <b>Complexity</b>: Constant.
stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<ValueAllocator>::value)
: internal_data(), index()
{
STABLE_VECTOR_CHECK_INVARIANT;

View File

@@ -87,9 +87,9 @@ class basic_string_base
basic_string_base & operator=(const basic_string_base &);
basic_string_base(const basic_string_base &);
typedef allocator_traits<Allocator> allocator_traits_type;
public:
typedef Allocator allocator_type;
public:
typedef allocator_traits<allocator_type> allocator_traits_type;
typedef allocator_type stored_allocator_type;
typedef typename allocator_traits_type::pointer pointer;
typedef typename allocator_traits_type::value_type value_type;
@@ -207,7 +207,7 @@ class basic_string_base
};
struct members_holder
: public Allocator
: public allocator_type
{
void init()
{
@@ -217,12 +217,12 @@ class basic_string_base
}
members_holder()
: Allocator()
: allocator_type()
{ this->init(); }
template<class AllocatorConvertible>
explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
: Allocator(boost::forward<AllocatorConvertible>(a))
: allocator_type(boost::forward<AllocatorConvertible>(a))
{ this->init(); }
const short_t *pshort_repr() const
@@ -240,10 +240,10 @@ class basic_string_base
repr_t m_repr;
} members_;
const Allocator &alloc() const
const allocator_type &alloc() const
{ return members_; }
Allocator &alloc()
allocator_type &alloc()
{ return members_; }
static const size_type InternalBufferChars = (sizeof(repr_t) - ShortDataOffset)/sizeof(value_type);
@@ -311,7 +311,7 @@ class basic_string_base
protected:
typedef dtl::integral_constant<unsigned,
boost::container::dtl::version<Allocator>::value> alloc_version;
boost::container::dtl::version<allocator_type>::value> alloc_version;
pointer allocation_command(allocation_type command,
size_type limit_size,
@@ -322,7 +322,7 @@ class basic_string_base
reuse = 0;
command &= ~(expand_fwd | expand_bwd);
}
return dtl::allocator_version_traits<Allocator>::allocation_command
return dtl::allocator_version_traits<allocator_type>::allocation_command
(this->alloc(), command, limit_size, prefer_in_recvd_out_size, reuse);
}
@@ -538,18 +538,18 @@ class basic_string_base
//! \tparam Traits The Character Traits type, which encapsulates basic character operations
//! \tparam Allocator The allocator, used for internal memory management.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = new_allocator<CharT> >
template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = void >
#else
template <class CharT, class Traits, class Allocator>
#endif
class basic_string
: private dtl::basic_string_base<Allocator>
: private dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef allocator_traits<Allocator> allocator_traits_type;
BOOST_COPYABLE_AND_MOVABLE(basic_string)
typedef dtl::basic_string_base<Allocator> base_t;
typedef dtl::basic_string_base<typename real_allocator<CharT, Allocator>::type> base_t;
typedef typename base_t::allocator_traits_type allocator_traits_type;
static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
protected:
@@ -596,13 +596,13 @@ class basic_string
//////////////////////////////////////////////
typedef Traits traits_type;
typedef CharT value_type;
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
typedef Allocator allocator_type;
typedef typename real_allocator<CharT, Allocator>::type allocator_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<allocator_type>::reference reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<allocator_type>::size_type size_type;
typedef typename ::boost::container::allocator_traits<allocator_type>::difference_type difference_type;
typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
@@ -639,7 +639,7 @@ class basic_string
//! <b>Effects</b>: Default constructs a basic_string.
//!
//! <b>Throws</b>: If allocator_type's default constructor throws.
basic_string() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value)
basic_string() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<allocator_type>::value)
: base_t()
{ this->priv_terminate_string(); }
@@ -667,7 +667,7 @@ class basic_string
//!
//! <b>Throws</b>: If allocator_type's default constructor or allocation throws.
template<template <class, class> class BasicStringView>
explicit basic_string(BasicStringView<CharT, Traits> sv, const Allocator& a = Allocator())
explicit basic_string(BasicStringView<CharT, Traits> sv, const allocator_type& a = allocator_type())
: base_t(allocator_traits_type::select_on_container_copy_construction(a))
{
this->priv_terminate_string();
@@ -2306,7 +2306,7 @@ class basic_string
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find(basic_string<CharT,traits,Allocator>(s,n),pos).
//! <b>Returns</b>: find(basic_string<CharT,traits,allocator_type>(s,n),pos).
size_type find(const CharT* s, size_type pos, size_type n) const
{
if (pos + n > this->size())
@@ -2332,7 +2332,7 @@ class basic_string
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find(basic_string<CharT,traits,Allocator>(1,c), pos).
//! <b>Returns</b>: find(basic_string<CharT,traits,allocator_type>(1,c), pos).
size_type find(CharT c, size_type pos = 0) const
{
const size_type sz = this->size();
@@ -2404,7 +2404,7 @@ class basic_string
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: rfind(basic_string<CharT,traits,Allocator>(1,c),pos).
//! <b>Returns</b>: rfind(basic_string<CharT,traits,allocator_type>(1,c),pos).
size_type rfind(CharT c, size_type pos = npos) const
{
const size_type len = this->size();
@@ -2472,7 +2472,7 @@ class basic_string
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_first_of(basic_string<CharT,traits,Allocator>(1,c), pos).
//! <b>Returns</b>: find_first_of(basic_string<CharT,traits,allocator_type>(1,c), pos).
size_type find_first_of(CharT c, size_type pos = 0) const
{ return this->find(c, pos); }
@@ -2522,7 +2522,7 @@ class basic_string
//!
//! <b>Throws</b>: Nothing
//!
//! <b>Returns</b>: find_last_of(basic_string<CharT,traits,Allocator>(1,c),pos).
//! <b>Returns</b>: find_last_of(basic_string<CharT,traits,allocator_type>(1,c),pos).
size_type find_last_of(const CharT* s, size_type pos = npos) const
{ return find_last_of(s, pos, Traits::length(s)); }
@@ -2672,7 +2672,7 @@ class basic_string
//!
//! <b>Throws</b>: If memory allocation throws or out_of_range if pos > size().
//!
//! <b>Returns</b>: basic_string<CharT,traits,Allocator>(data()+pos,rlen).
//! <b>Returns</b>: basic_string<CharT,traits,allocator_type>(data()+pos,rlen).
basic_string substr(size_type pos = 0, size_type n = npos) const
{
if (pos > this->size())
@@ -3490,7 +3490,8 @@ namespace boost {
template <class C, class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::basic_string<C, T, Allocator> >
{
typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename ::boost::container::allocator_traits
<typename boost::container::basic_string<C, T, Allocator>::allocator_type>::pointer pointer;
static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value &&
::boost::has_trivial_destructor_after_move<pointer>::value;
};

View File

@@ -236,18 +236,6 @@ struct vector_value_traits_base
static const bool nothrow_assign = dtl::is_nothrow_copy_assignable<T>::value || trivial_assign;
};
template<class T, class AllocatorOrVoid>
struct real_allocator
{
typedef AllocatorOrVoid type;
};
template<class T>
struct real_allocator<T, void>
{
typedef new_allocator<T> type;
};
template <class Allocator>
struct vector_value_traits
: public vector_value_traits_base<typename Allocator::value_type>