Replace "Allocator" template parameter with "A", according to the standard.

This commit is contained in:
Ion Gaztañaga
2014-12-11 22:01:58 +01:00
parent 456e9fedcb
commit 955248b739
23 changed files with 970 additions and 796 deletions

View File

@@ -79,7 +79,7 @@ template class bc::node_allocator
, bc::NodeAlloc_nodes_per_block
, 2>;
template<class Allocator> struct get_allocator_name;
template<class A> struct get_allocator_name;
template<> struct get_allocator_name<StdAllocator>
{ static const char *get() { return "StdAllocator"; } };
@@ -124,10 +124,10 @@ class MyInt
}
};
template<class Allocator>
template<class A>
void list_test_template(std::size_t num_iterations, std::size_t num_elements, bool csv_output)
{
typedef typename Allocator::template rebind<MyInt>::other IntAllocator;
typedef typename A::template rebind<MyInt>::other IntAllocator;
nanosecond_type tinsert, terase;
boost_cont_malloc_stats_t insert_stats, erase_stats;
std::size_t insert_inuse, erase_inuse;
@@ -181,7 +181,7 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
if(csv_output){
std::cout << get_allocator_name<Allocator>::get()
std::cout << get_allocator_name<A>::get()
<< ";"
<< num_iterations
<< ";"
@@ -206,7 +206,7 @@ void list_test_template(std::size_t num_iterations, std::size_t num_elements, bo
}
else{
std::cout << std::endl
<< "Allocator: " << get_allocator_name<Allocator>::get()
<< "A: " << get_allocator_name<A>::get()
<< std::endl
<< " allocation/deallocation(ns): " << float(tinsert)/(num_iterations*num_elements) << '\t' << float(terase)/(num_iterations*num_elements)
<< std::endl

View File

@@ -32,7 +32,7 @@ typedef bc::allocator<int, 2, bc::expand_bwd | bc::expand_fwd> AllocatorPlusV2Ma
typedef bc::allocator<int, 2, bc::expand_fwd> AllocatorPlusV2;
typedef bc::allocator<int, 1> AllocatorPlusV1;
template<class Allocator> struct get_allocator_name;
template<class A> struct get_allocator_name;
template<> struct get_allocator_name<StdAllocator>
{ static const char *get() { return "StdAllocator"; } };
@@ -90,14 +90,14 @@ struct has_trivial_destructor_after_move<MyInt>
void print_header()
{
std::cout << "Allocator" << ";" << "Iterations" << ";" << "Size" << ";"
<< "Capacity" << ";" << "push_back(ns)" << ";" << "Allocator calls" << ";"
<< "Capacity" << ";" << "push_back(ns)" << ";" << "A calls" << ";"
<< "New allocations" << ";" << "Bwd expansions" << std::endl;
}
template<class Allocator>
template<class A>
void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
{
typedef typename Allocator::template rebind<MyInt>::other IntAllocator;
typedef typename A::template rebind<MyInt>::other IntAllocator;
unsigned int numalloc = 0, numexpand = 0;
cpu_timer timer;
@@ -132,7 +132,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
nanosecond_type nseconds = timer.elapsed().wall;
if(csv_output){
std::cout << get_allocator_name<Allocator>::get()
std::cout << get_allocator_name<A>::get()
<< ";"
<< num_iterations
<< ";"
@@ -151,7 +151,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
}
else{
std::cout << std::endl
<< "Allocator: " << get_allocator_name<Allocator>::get()
<< "A: " << get_allocator_name<A>::get()
<< std::endl
<< " push_back ns: "
<< float(nseconds)/(num_iterations*num_elements)

View File

@@ -35,7 +35,7 @@ typedef bc::allocator<int, 2, bc::expand_bwd | bc::expand_fwd> AllocatorPlusV2Ma
typedef bc::allocator<int, 2> AllocatorPlusV2;
typedef bc::allocator<int, 1> AllocatorPlusV1;
template<class Allocator> struct get_allocator_name;
template<class A> struct get_allocator_name;
template<> struct get_allocator_name<StdAllocator>
{ static const char *get() { return "StdAllocator"; } };
@@ -124,10 +124,10 @@ class MyInt
}
};
template<class Allocator, template <class, class> class Vector>
template<class A, template <class, class> class Vector>
void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
{
typedef typename Allocator::template rebind<MyInt>::other IntAllocator;
typedef typename A::template rebind<MyInt>::other IntAllocator;
unsigned int numalloc = 0, numexpand = 0;
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
@@ -193,7 +193,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
nanosecond_type nseconds = timer.elapsed().wall;
if(csv_output){
std::cout << get_allocator_name<Allocator>::get()
std::cout << get_allocator_name<A>::get()
<< ";"
<< num_iterations
<< ";"
@@ -212,7 +212,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
}
else{
std::cout << std::endl
<< "Allocator: " << get_allocator_name<Allocator>::get()
<< "A: " << get_allocator_name<A>::get()
<< std::endl
<< " push_back ns: "
<< float(nseconds)/(num_iterations*num_elements)
@@ -229,7 +229,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
void print_header()
{
std::cout << "Allocator" << ";" << "Iterations" << ";" << "Size" << ";"
<< "Capacity" << ";" << "push_back(ns)" << ";" << "Allocator calls" << ";"
<< "Capacity" << ";" << "push_back(ns)" << ";" << "A calls" << ";"
<< "New allocations" << ";" << "Fwd expansions" << std::endl;
}

View File

@@ -34,7 +34,7 @@ typedef std::allocator<int> StdAllocator;
typedef bc::allocator<int, 2> AllocatorPlusV2;
typedef bc::allocator<int, 1> AllocatorPlusV1;
template<class Allocator> struct get_allocator_name;
template<class A> struct get_allocator_name;
template<> struct get_allocator_name<StdAllocator>
{ static const char *get() { return "StdAllocator"; } };
@@ -69,10 +69,10 @@ void print_header()
<< "num_shrink" << ";" << "shrink_to_fit(ns)" << std::endl;
}
template<class Allocator>
template<class A>
void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
{
typedef typename Allocator::template rebind<MyInt>::other IntAllocator;
typedef typename A::template rebind<MyInt>::other IntAllocator;
unsigned int capacity = 0;
const std::size_t Step = 5;
@@ -84,7 +84,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
#ifndef NDEBUG
typedef bc::container_detail::integral_constant
<unsigned, bc::container_detail::version<Allocator>::value> alloc_version;
<unsigned, bc::container_detail::version<A>::value> alloc_version;
#endif
for(unsigned int r = 0; r != num_iterations; ++r){
@@ -105,7 +105,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
nanosecond_type nseconds = timer.elapsed().wall;
if(csv_output){
std::cout << get_allocator_name<Allocator>::get()
std::cout << get_allocator_name<A>::get()
<< ";"
<< num_iterations
<< ";"
@@ -118,7 +118,7 @@ void vector_test_template(unsigned int num_iterations, unsigned int num_elements
}
else{
std::cout << std::endl
<< "Allocator: " << get_allocator_name<Allocator>::get()
<< "A: " << get_allocator_name<A>::get()
<< std::endl
<< " num_shrink: " << num_shrink
<< std::endl

View File

@@ -41,7 +41,7 @@ typedef bc::adaptive_pool
, 2
, 2> AdPool2PercentV2;
template<class Allocator> struct get_allocator_name;
template<class A> struct get_allocator_name;
template<> struct get_allocator_name<StdAllocator>
{ static const char *get() { return "StdAllocator"; } };
@@ -71,32 +71,32 @@ class MyInt
}
};
template<class Allocator>
template<class A>
struct get_vector
{
typedef bc::vector
<MyInt, typename Allocator::template rebind<MyInt>::other> type;
<MyInt, typename A::template rebind<MyInt>::other> type;
static const char *vector_name()
{
return "vector<MyInt>";
}
};
template<class Allocator>
template<class A>
struct get_stable_vector
{
typedef bc::stable_vector
<MyInt, typename Allocator::template rebind<MyInt>::other> type;
<MyInt, typename A::template rebind<MyInt>::other> type;
static const char *vector_name()
{
return "stable_vector<MyInt>";
}
};
template<template<class> class GetContainer, class Allocator>
template<template<class> class GetContainer, class A>
void stable_vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output)
{
typedef typename GetContainer<Allocator>::type vector_type;
typedef typename GetContainer<A>::type vector_type;
//std::size_t top_capacity = 0;
nanosecond_type nseconds;
{
@@ -113,9 +113,9 @@ void stable_vector_test_template(unsigned int num_iterations, unsigned int num_e
nseconds = timer.elapsed().wall;
if(csv_output){
std::cout << get_allocator_name<Allocator>::get()
std::cout << get_allocator_name<A>::get()
<< ";"
<< GetContainer<Allocator>::vector_name()
<< GetContainer<A>::vector_name()
<< ";"
<< num_iterations
<< ";"
@@ -125,9 +125,9 @@ void stable_vector_test_template(unsigned int num_iterations, unsigned int num_e
<< ";";
}
else{
std::cout << "Allocator: " << get_allocator_name<Allocator>::get()
std::cout << "Allocator: " << get_allocator_name<A>::get()
<< '\t'
<< GetContainer<Allocator>::vector_name()
<< GetContainer<A>::vector_name()
<< std::endl
<< " allocation ns: "
<< float(nseconds)/(num_iterations*num_elements);

View File

@@ -84,17 +84,17 @@ struct def
//!
//! This strategy defines the same types that are defined in the Allocator.
//!
//! @tparam Allocator The Allocator which will be adapted.
template <typename Allocator>
//! @tparam A The Allocator which will be adapted.
template <typename A>
struct allocator_adaptor
{
typedef typename Allocator::value_type value_type;
typedef typename Allocator::size_type size_type;
typedef typename Allocator::difference_type difference_type;
typedef typename Allocator::pointer pointer;
typedef typename Allocator::const_pointer const_pointer;
typedef typename Allocator::reference reference;
typedef typename Allocator::const_reference const_reference;
typedef typename A::value_type value_type;
typedef typename A::size_type size_type;
typedef typename A::difference_type difference_type;
typedef typename A::pointer pointer;
typedef typename A::const_pointer const_pointer;
typedef typename A::reference reference;
typedef typename A::const_reference const_reference;
static void allocate_failed()
{

View File

@@ -17,14 +17,14 @@ namespace boost { namespace container { namespace container_detail { namespace c
/**
* VArrayStrategyConcept
*
* \brief Checks strategy for varray<Value,Capacity,Strategy>, which has similarities to std::Allocator
* \brief Checks strategy for varray<Value,Capacity,Strategy>, which has similarities to std::allocator
* \ingroup varray
*/
template<typename Strategy>
struct VArrayStrategy {
#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
// typedefs are the same as in std::Allocator
// typedefs are the same as in std::allocator
typedef typename Strategy::value_type value_type;
typedef typename Strategy::size_type size_type;
typedef typename Strategy::difference_type difference_type;

View File

@@ -81,26 +81,26 @@ enum tree_type_enum
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T
,class Allocator = std::allocator<T> >
,class A = std::allocator<T> >
class vector;
template <class T
,class Allocator = std::allocator<T> >
,class A = std::allocator<T> >
class stable_vector;
template <class T, std::size_t Capacity>
class static_vector;
template <class T
,class Allocator = std::allocator<T> >
,class A = std::allocator<T> >
class deque;
template <class T
,class Allocator = std::allocator<T> >
,class A = std::allocator<T> >
class list;
template <class T
,class Allocator = std::allocator<T> >
,class A = std::allocator<T> >
class slist;
template<tree_type_enum TreeType, bool OptimizeSize>
@@ -110,55 +110,55 @@ typedef tree_opt<red_black_tree, true> tree_assoc_defaults;
template <class Key
,class Compare = std::less<Key>
,class Allocator = std::allocator<Key>
,class A = std::allocator<Key>
,class Options = tree_assoc_defaults >
class set;
template <class Key
,class Compare = std::less<Key>
,class Allocator = std::allocator<Key>
,class A = std::allocator<Key>
,class Options = tree_assoc_defaults >
class multiset;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<const Key, T> >
,class A = std::allocator<std::pair<const Key, T> >
,class Options = tree_assoc_defaults >
class map;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<const Key, T> >
,class A = std::allocator<std::pair<const Key, T> >
,class Options = tree_assoc_defaults >
class multimap;
template <class Key
,class Compare = std::less<Key>
,class Allocator = std::allocator<Key> >
,class A = std::allocator<Key> >
class flat_set;
template <class Key
,class Compare = std::less<Key>
,class Allocator = std::allocator<Key> >
,class A = std::allocator<Key> >
class flat_multiset;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<Key, T> > >
,class A = std::allocator<std::pair<Key, T> > >
class flat_map;
template <class Key
,class T
,class Compare = std::less<Key>
,class Allocator = std::allocator<std::pair<Key, T> > >
,class A = std::allocator<std::pair<Key, T> > >
class flat_multimap;
template <class CharT
,class Traits = std::char_traits<CharT>
,class Allocator = std::allocator<CharT> >
,class A = std::allocator<CharT> >
class basic_string;
typedef basic_string

View File

@@ -54,7 +54,7 @@ namespace boost {
namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator>
template <class T, class A>
class deque;
template <class T>
@@ -104,7 +104,7 @@ namespace container_detail {
// [map, map + map_size) is a valid, non-empty range.
// [start.node, finish.node] is a valid range contained within
// [map, map + map_size).
// Allocator pointer in the range [map, map + map_size) points to an allocated node
// A pointer in the range [map, map + map_size) points to an allocated node
// if and only if the pointer is in the range [start.node, finish.node].
template<class Pointer, bool IsConst>
class deque_iterator
@@ -276,12 +276,12 @@ class deque_iterator
// Deque base class. It has two purposes. First, its constructor
// and destructor allocate (but don't initialize) storage. This makes
// exception safety easier.
template <class Allocator>
template <class A>
class deque_base
{
BOOST_COPYABLE_AND_MOVABLE(deque_base)
public:
typedef allocator_traits<Allocator> val_alloc_traits_type;
typedef allocator_traits<A> val_alloc_traits_type;
typedef typename val_alloc_traits_type::value_type val_alloc_val;
typedef typename val_alloc_traits_type::pointer val_alloc_ptr;
typedef typename val_alloc_traits_type::const_pointer val_alloc_cptr;
@@ -297,7 +297,7 @@ class deque_base
typedef typename ptr_alloc_traits_type::const_pointer ptr_alloc_cptr;
typedef typename ptr_alloc_traits_type::reference ptr_alloc_ref;
typedef typename ptr_alloc_traits_type::const_reference ptr_alloc_cref;
typedef Allocator allocator_type;
typedef A allocator_type;
typedef allocator_type stored_allocator_type;
typedef val_alloc_size size_type;
@@ -476,16 +476,16 @@ class deque_base
//! and removal of elements at the end of the sequence, and linear time insertion and removal of elements in the middle.
//!
//! \tparam T The type of object that is stored in the deque
//! \tparam Allocator The allocator used for all internal memory management
template <class T, class Allocator = std::allocator<T> >
//! \tparam A The allocator used for all internal memory management
template <class T, class A = std::allocator<T> >
#else
template <class T, class Allocator>
template <class T, class A>
#endif
class deque : protected deque_base<Allocator>
class deque : protected deque_base<A>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef deque_base<Allocator> Base;
typedef deque_base<A> Base;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -497,13 +497,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 typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -517,7 +517,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<A> allocator_traits_type;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -556,7 +556,7 @@ class deque : protected deque_base<Allocator>
explicit deque(size_type n)
: Base(n, allocator_type())
{
container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
container_detail::insert_value_initialized_n_proxy<A, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception...
}
@@ -573,7 +573,7 @@ class deque : protected deque_base<Allocator>
deque(size_type n, default_init_t)
: Base(n, allocator_type())
{
container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
container_detail::insert_default_initialized_n_proxy<A, iterator> proxy;
proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n);
//deque_base will deallocate in case of exception...
}
@@ -1031,7 +1031,7 @@ class deque : protected deque_base<Allocator>
this->priv_erase_last_n(len - new_size);
else{
const size_type n = new_size - this->size();
container_detail::insert_value_initialized_n_proxy<Allocator, iterator> proxy;
container_detail::insert_value_initialized_n_proxy<A, iterator> proxy;
priv_insert_back_aux_impl(n, proxy);
}
}
@@ -1051,7 +1051,7 @@ class deque : protected deque_base<Allocator>
this->priv_erase_last_n(len - new_size);
else{
const size_type n = new_size - this->size();
container_detail::insert_default_initialized_n_proxy<Allocator, iterator> proxy;
container_detail::insert_default_initialized_n_proxy<A, iterator> proxy;
priv_insert_back_aux_impl(n, proxy);
}
}
@@ -1268,7 +1268,7 @@ class deque : protected deque_base<Allocator>
this->priv_push_front_simple_commit();
}
else{
typedef container_detail::insert_non_movable_emplace_proxy<Allocator, iterator, Args...> type;
typedef container_detail::insert_non_movable_emplace_proxy<A, iterator, Args...> type;
this->priv_insert_front_aux_impl(1, type(boost::forward<Args>(args)...));
}
}
@@ -1290,7 +1290,7 @@ class deque : protected deque_base<Allocator>
this->priv_push_back_simple_commit();
}
else{
typedef container_detail::insert_non_movable_emplace_proxy<Allocator, iterator, Args...> type;
typedef container_detail::insert_non_movable_emplace_proxy<A, iterator, Args...> type;
this->priv_insert_back_aux_impl(1, type(boost::forward<Args>(args)...));
}
}
@@ -1316,7 +1316,7 @@ class deque : protected deque_base<Allocator>
return (this->end()-1);
}
else{
typedef container_detail::insert_emplace_proxy<Allocator, iterator, Args...> type;
typedef container_detail::insert_emplace_proxy<A, iterator, Args...> type;
return this->priv_insert_aux_impl(p, 1, type(boost::forward<Args>(args)...));
}
}
@@ -1337,7 +1337,7 @@ class deque : protected deque_base<Allocator>
} \
else{ \
typedef container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \
<Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
<A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
priv_insert_front_aux_impl \
(1, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
} \
@@ -1355,7 +1355,7 @@ class deque : protected deque_base<Allocator>
} \
else{ \
typedef container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \
<Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
<A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
priv_insert_back_aux_impl \
(1, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
} \
@@ -1375,7 +1375,7 @@ class deque : protected deque_base<Allocator>
} \
else{ \
typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
<Allocator, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
<A, iterator BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
return this->priv_insert_aux_impl \
(p, 1, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _))); \
} \
@@ -1526,7 +1526,7 @@ class deque : protected deque_base<Allocator>
#endif
)
{
container_detail::insert_range_proxy<Allocator, FwdIt, iterator> proxy(first);
container_detail::insert_range_proxy<A, FwdIt, iterator> proxy(first);
return priv_insert_aux_impl(p, boost::container::iterator_distance(first, last), proxy);
}
#endif
@@ -1749,7 +1749,7 @@ class deque : protected deque_base<Allocator>
else {
return priv_insert_aux_impl
( p, (size_type)1
, container_detail::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
, container_detail::get_insert_value_proxy<iterator, A>(::boost::forward<U>(x)));
}
}
@@ -1764,7 +1764,7 @@ class deque : protected deque_base<Allocator>
else{
priv_insert_aux_impl
( this->cbegin(), (size_type)1
, container_detail::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
, container_detail::get_insert_value_proxy<iterator, A>(::boost::forward<U>(x)));
}
}
@@ -1779,7 +1779,7 @@ class deque : protected deque_base<Allocator>
else{
priv_insert_aux_impl
( this->cend(), (size_type)1
, container_detail::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x)));
, container_detail::get_insert_value_proxy<iterator, A>(::boost::forward<U>(x)));
}
}
@@ -2125,9 +2125,9 @@ namespace boost {
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::deque<T, Allocator> >
: public ::boost::has_trivial_destructor_after_move<Allocator>
template <class T, class A>
struct has_trivial_destructor_after_move<boost::container::deque<T, A> >
: public ::boost::has_trivial_destructor_after_move<A>
{};
}

View File

@@ -32,32 +32,32 @@ namespace boost {
namespace container {
namespace container_detail {
template<class Allocator, unsigned Version = boost::container::container_detail::version<Allocator>::value>
template<class A, unsigned Version = boost::container::container_detail::version<A>::value>
struct allocator_version_traits
{
typedef ::boost::container::container_detail::integral_constant
<unsigned, Version> alloc_version;
typedef typename Allocator::multiallocation_chain multiallocation_chain;
typedef typename A::multiallocation_chain multiallocation_chain;
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename boost::container::allocator_traits<A>::pointer pointer;
typedef typename boost::container::allocator_traits<A>::size_type size_type;
//Node allocation interface
static pointer allocate_one(Allocator &a)
static pointer allocate_one(A &a)
{ return a.allocate_one(); }
static void deallocate_one(Allocator &a, const pointer &p)
static void deallocate_one(A &a, const pointer &p)
{ a.deallocate_one(p); }
static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
static void allocate_individual(A &a, size_type n, multiallocation_chain &m)
{ return a.allocate_individual(n, m); }
static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
static void deallocate_individual(A &a, multiallocation_chain &holder)
{ a.deallocate_individual(holder); }
static std::pair<pointer, bool>
allocation_command(Allocator &a, allocation_type command,
allocation_command(A &a, allocation_type command,
size_type limit_size, size_type preferred_size,
size_type &received_size, const pointer &reuse)
{
@@ -66,15 +66,15 @@ struct allocator_version_traits
}
};
template<class Allocator>
struct allocator_version_traits<Allocator, 1>
template<class A>
struct allocator_version_traits<A, 1>
{
typedef ::boost::container::container_detail::integral_constant
<unsigned, 1> alloc_version;
typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
typedef typename boost::container::allocator_traits<A>::pointer pointer;
typedef typename boost::container::allocator_traits<A>::size_type size_type;
typedef typename boost::container::allocator_traits<A>::value_type value_type;
typedef typename boost::intrusive::pointer_traits<pointer>::
template rebind_pointer<void>::type void_ptr;
@@ -85,13 +85,13 @@ struct allocator_version_traits<Allocator, 1>
< multialloc_cached_counted, value_type> multiallocation_chain;
//Node allocation interface
static pointer allocate_one(Allocator &a)
static pointer allocate_one(A &a)
{ return a.allocate(1); }
static void deallocate_one(Allocator &a, const pointer &p)
static void deallocate_one(A &a, const pointer &p)
{ a.deallocate(p, 1); }
static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
static void deallocate_individual(A &a, multiallocation_chain &holder)
{
size_type n = holder.size();
typename multiallocation_chain::iterator it = holder.begin();
@@ -104,7 +104,7 @@ struct allocator_version_traits<Allocator, 1>
struct allocate_individual_rollback
{
allocate_individual_rollback(Allocator &a, multiallocation_chain &chain)
allocate_individual_rollback(A &a, multiallocation_chain &chain)
: mr_a(a), mp_chain(&chain)
{}
@@ -119,11 +119,11 @@ struct allocator_version_traits<Allocator, 1>
mp_chain = 0;
}
Allocator &mr_a;
A &mr_a;
multiallocation_chain * mp_chain;
};
static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
static void allocate_individual(A &a, size_type n, multiallocation_chain &m)
{
allocate_individual_rollback rollback(a, m);
while(n--){
@@ -133,7 +133,7 @@ struct allocator_version_traits<Allocator, 1>
}
static std::pair<pointer, bool>
allocation_command(Allocator &a, allocation_type command,
allocation_command(A &a, allocation_type command,
size_type, size_type preferred_size,
size_type &received_size, const pointer &)
{

View File

@@ -76,14 +76,14 @@ struct scoped_deallocator
{ m_ptr = 0; }
};
template <class Allocator>
template <class A>
struct null_scoped_deallocator
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::pointer pointer;
typedef typename AllocTraits::size_type size_type;
null_scoped_deallocator(pointer, Allocator&, size_type)
null_scoped_deallocator(pointer, A&, size_type)
{}
void release()
@@ -98,14 +98,14 @@ struct null_scoped_deallocator
//!A deleter for scoped_ptr that deallocates the memory
//!allocated for an array of objects using a STL allocator.
template <class Allocator>
template <class A>
struct scoped_array_deallocator
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::pointer pointer;
typedef typename AllocTraits::size_type size_type;
scoped_array_deallocator(pointer p, Allocator& a, size_type length)
scoped_array_deallocator(pointer p, A& a, size_type length)
: m_ptr(p), m_alloc(a), m_length(length) {}
~scoped_array_deallocator()
@@ -116,37 +116,37 @@ struct scoped_array_deallocator
private:
pointer m_ptr;
Allocator& m_alloc;
A& m_alloc;
size_type m_length;
};
template <class Allocator>
template <class A>
struct null_scoped_array_deallocator
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::pointer pointer;
typedef typename AllocTraits::size_type size_type;
null_scoped_array_deallocator(pointer, Allocator&, size_type)
null_scoped_array_deallocator(pointer, A&, size_type)
{}
void release()
{}
};
template <class Allocator>
template <class A>
struct scoped_destroy_deallocator
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::pointer pointer;
typedef typename AllocTraits::size_type size_type;
typedef container_detail::integral_constant<unsigned,
boost::container::container_detail::
version<Allocator>::value> alloc_version;
version<A>::value> alloc_version;
typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
scoped_destroy_deallocator(pointer p, Allocator& a)
scoped_destroy_deallocator(pointer p, A& a)
: m_ptr(p), m_alloc(a) {}
~scoped_destroy_deallocator()
@@ -169,21 +169,21 @@ struct scoped_destroy_deallocator
{ m_alloc.deallocate_one(p); }
pointer m_ptr;
Allocator& m_alloc;
A& m_alloc;
};
//!A deleter for scoped_ptr that destroys
//!an object using a STL allocator.
template <class Allocator>
template <class A>
struct scoped_destructor_n
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::pointer pointer;
typedef typename AllocTraits::value_type value_type;
typedef typename AllocTraits::size_type size_type;
scoped_destructor_n(pointer p, Allocator& a, size_type n)
scoped_destructor_n(pointer p, A& a, size_type n)
: m_p(p), m_a(a), m_n(n)
{}
@@ -210,20 +210,20 @@ struct scoped_destructor_n
private:
pointer m_p;
Allocator & m_a;
A & m_a;
size_type m_n;
};
//!A deleter for scoped_ptr that destroys
//!an object using a STL allocator.
template <class Allocator>
template <class A>
struct null_scoped_destructor_n
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::pointer pointer;
typedef typename AllocTraits::size_type size_type;
null_scoped_destructor_n(pointer, Allocator&, size_type)
null_scoped_destructor_n(pointer, A&, size_type)
{}
void increment_size(size_type)
@@ -290,20 +290,20 @@ class value_destructor
A &a_;
};
template <class Allocator>
template <class A>
class allocator_destroyer
{
typedef boost::container::allocator_traits<Allocator> AllocTraits;
typedef boost::container::allocator_traits<A> AllocTraits;
typedef typename AllocTraits::value_type value_type;
typedef typename AllocTraits::pointer pointer;
typedef container_detail::integral_constant<unsigned,
boost::container::container_detail::
version<Allocator>::value> alloc_version;
version<A>::value> alloc_version;
typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
private:
Allocator & a_;
A & a_;
private:
void priv_deallocate(const pointer &p, allocator_v1)
@@ -313,7 +313,7 @@ class allocator_destroyer
{ a_.deallocate_one(p); }
public:
allocator_destroyer(Allocator &a)
allocator_destroyer(A &a)
: a_(a)
{}

View File

@@ -37,13 +37,13 @@ public:
const allocator_type& a = allocator_type());
explicit hash_set(const allocator_type&);
hash_set(const hash_set&);
hash_set(const hash_set&, const Allocator&);
hash_set(const hash_set&, const A&);
hash_set(hash_set&&)
noexcept(
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value &&
is_nothrow_move_constructible<allocator_type>::value);
hash_set(hash_set&&, const Allocator&);
hash_set(hash_set&&, const A&);
hash_set(initializer_list<value_type>, size_type n = 0,
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type());
@@ -162,13 +162,13 @@ public:
const allocator_type& a = allocator_type());
explicit hash_map(const allocator_type&);
hash_map(const hash_map&);
hash_map(const hash_map&, const Allocator&);
hash_map(const hash_map&, const A&);
hash_map(hash_map&&)
noexcept(
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value &&
is_nothrow_move_constructible<allocator_type>::value);
hash_map(hash_map&&, const Allocator&);
hash_map(hash_map&&, const A&);
hash_map(initializer_list<value_type>, size_type n = 0,
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type());
@@ -296,13 +296,13 @@ public:
const allocator_type& a = allocator_type());
explicit hash_set(const allocator_type&);
hash_set(const hash_set&);
hash_set(const hash_set&, const Allocator&);
hash_set(const hash_set&, const A&);
hash_set(hash_set&&)
noexcept(
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value &&
is_nothrow_move_constructible<allocator_type>::value);
hash_set(hash_set&&, const Allocator&);
hash_set(hash_set&&, const A&);
hash_set(initializer_list<value_type>, size_type n = 0,
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type());

View File

@@ -72,7 +72,7 @@ static D force_copy(S s)
//!
//! Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//!
//! Allocator is the allocator to allocate the value_types
//! A is the allocator to allocate the value_types
//! (e.g. <i>allocator< std::pair<Key, T> ></i>).
//!
//! flat_map is similar to std::map but it's implemented like an ordered vector.
@@ -87,12 +87,12 @@ static D force_copy(S s)
//! \tparam Key is the key_type of the map
//! \tparam Value is the <code>mapped_type</code>
//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
//! \tparam A is the allocator to allocate the <code>value_type</code>s
//! (e.g. <i>allocator< std::pair<Key, T> > </i>).
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator< std::pair< Key, T> > >
template <class Key, class T, class Compare = std::less<Key>, class A = std::allocator< std::pair< Key, T> > >
#else
template <class Key, class T, class Compare, class Allocator>
template <class Key, class T, class Compare, class A>
#endif
class flat_map
{
@@ -104,14 +104,14 @@ class flat_map
std::pair<Key, T>,
container_detail::select1st< std::pair<Key, T> >,
Compare,
Allocator> tree_t;
A> tree_t;
//This is the real tree stored here. It's based on a movable pair
typedef container_detail::flat_tree<Key,
container_detail::pair<Key, T>,
container_detail::select1st<container_detail::pair<Key, T> >,
Compare,
typename allocator_traits<Allocator>::template portable_rebind_alloc
typename allocator_traits<A>::template portable_rebind_alloc
<container_detail::pair<Key, T> >::type> impl_tree_t;
impl_tree_t m_flat_tree; // flat tree representing flat_map
@@ -124,13 +124,13 @@ class flat_map
, container_detail::select1st< std::pair<Key, T> >
, std::pair<Key, T> > value_compare_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::iterator iterator_impl;
<typename allocator_traits<A>::pointer>::iterator iterator_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::const_iterator const_iterator_impl;
<typename allocator_traits<A>::pointer>::const_iterator const_iterator_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::reverse_iterator reverse_iterator_impl;
<typename allocator_traits<A>::pointer>::reverse_iterator reverse_iterator_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::const_reverse_iterator const_reverse_iterator_impl;
<typename allocator_traits<A>::pointer>::const_reverse_iterator const_reverse_iterator_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -143,15 +143,15 @@ class flat_map
typedef Key key_type;
typedef T mapped_type;
typedef std::pair<Key, T> value_type;
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 BOOST_CONTAINER_IMPDEF(Allocator) stored_allocator_type;
typedef ::boost::container::allocator_traits<A> allocator_traits_type;
typedef typename boost::container::allocator_traits<A>::pointer pointer;
typedef typename boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<A>::reference reference;
typedef typename boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename boost::container::allocator_traits<A>::size_type size_type;
typedef typename boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_type;
typedef BOOST_CONTAINER_IMPDEF(A) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
typedef Compare key_compare;
typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
@@ -173,8 +173,8 @@ class flat_map
flat_map()
: m_flat_tree()
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_map using the specified
@@ -184,8 +184,8 @@ class flat_map
explicit flat_map(const Compare& comp, const allocator_type& a = allocator_type())
: m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_map using the specified allocator.
@@ -194,8 +194,8 @@ class flat_map
explicit flat_map(const allocator_type& a)
: m_flat_tree(container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
@@ -208,8 +208,8 @@ class flat_map
const allocator_type& a = allocator_type())
: m_flat_tree(true, first, last, comp, container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
@@ -227,8 +227,8 @@ class flat_map
, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: m_flat_tree(ordered_range, first, last, comp, a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@@ -241,8 +241,8 @@ class flat_map
const allocator_type& a = allocator_type())
: m_flat_tree(true, il.begin(), il.end(), comp, container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and
@@ -259,8 +259,8 @@ class flat_map
const allocator_type& a = allocator_type())
: m_flat_tree(ordered_range, il.begin(), il.end(), comp, a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
#endif
@@ -270,8 +270,8 @@ class flat_map
flat_map(const flat_map& x)
: m_flat_tree(x.m_flat_tree)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a flat_map.
@@ -283,8 +283,8 @@ class flat_map
flat_map(BOOST_RV_REF(flat_map) x)
: m_flat_tree(boost::move(x.m_flat_tree))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a flat_map using the specified allocator.
@@ -293,8 +293,8 @@ class flat_map
flat_map(const flat_map& x, const allocator_type &a)
: m_flat_tree(x.m_flat_tree, a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a flat_map using the specified allocator.
@@ -304,8 +304,8 @@ class flat_map
flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a)
: m_flat_tree(boost::move(x.m_flat_tree), a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Makes *this a copy of x.
@@ -337,7 +337,7 @@ class flat_map
}
#endif
//! <b>Effects</b>: Returns a copy of the Allocator that
//! <b>Effects</b>: Returns a copy of the allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
@@ -542,7 +542,7 @@ class flat_map
//! Effects: If there is no key equivalent to x in the flat_map, inserts
//! value_type(x, T()) into the flat_map.
//!
//! Returns: Allocator reference to the mapped_type corresponding to x in *this.
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
//! Complexity: Logarithmic.
mapped_type &operator[](const key_type& k);
@@ -550,7 +550,7 @@ class flat_map
//! Effects: If there is no key equivalent to x in the flat_map, inserts
//! value_type(move(x), T()) into the flat_map (the key is move-constructed)
//!
//! Returns: Allocator reference to the mapped_type corresponding to x in *this.
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
//! Complexity: Logarithmic.
mapped_type &operator[](key_type &&k) ;
@@ -575,7 +575,7 @@ class flat_map
size_type index_of(const_iterator p) const BOOST_CONTAINER_NOEXCEPT
{ return m_flat_tree.index_of(container_detail::force_copy<impl_const_iterator>(p)); }
//! Returns: Allocator reference to the element whose key is equivalent to x.
//! Returns: A reference to the element whose key is equivalent to x.
//!
//! Throws: An exception object of type out_of_range if no such element is present.
//!
@@ -589,7 +589,7 @@ class flat_map
return i->second;
}
//! Returns: Allocator reference to the element whose key is equivalent to x.
//! Returns: A reference to the element whose key is equivalent to x.
//!
//! Throws: An exception object of type out_of_range if no such element is present.
//!
@@ -912,7 +912,7 @@ class flat_map
iterator find(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.find(x)); }
//! <b>Returns</b>: Allocator const_iterator pointing to an element with the key
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.s
@@ -932,7 +932,7 @@ class flat_map
iterator lower_bound(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -946,7 +946,7 @@ class flat_map
iterator upper_bound(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -1039,10 +1039,10 @@ class flat_map
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class K, class T, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::flat_map<K, T, C, Allocator> >
template <class K, class T, class C, class A>
struct has_trivial_destructor_after_move<boost::container::flat_map<K, T, C, A> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
namespace container {
@@ -1061,7 +1061,7 @@ namespace container {
//!
//! Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//!
//! Allocator is the allocator to allocate the value_types
//! A is the allocator to allocate the value_types
//! (e.g. <i>allocator< std::pair<Key, T> ></i>).
//!
//! flat_multimap is similar to std::multimap but it's implemented like an ordered vector.
@@ -1076,12 +1076,12 @@ namespace container {
//! \tparam Key is the key_type of the map
//! \tparam Value is the <code>mapped_type</code>
//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
//! \tparam A is the allocator to allocate the <code>value_type</code>s
//! (e.g. <i>allocator< std::pair<Key, T> > </i>).
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class Key, class T, class Compare = std::less<Key>, class Allocator = std::allocator< std::pair< Key, T> > >
template <class Key, class T, class Compare = std::less<Key>, class A = std::allocator< std::pair< Key, T> > >
#else
template <class Key, class T, class Compare, class Allocator>
template <class Key, class T, class Compare, class A>
#endif
class flat_multimap
{
@@ -1092,13 +1092,13 @@ class flat_multimap
std::pair<Key, T>,
container_detail::select1st< std::pair<Key, T> >,
Compare,
Allocator> tree_t;
A> tree_t;
//This is the real tree stored here. It's based on a movable pair
typedef container_detail::flat_tree<Key,
container_detail::pair<Key, T>,
container_detail::select1st<container_detail::pair<Key, T> >,
Compare,
typename allocator_traits<Allocator>::template portable_rebind_alloc
typename allocator_traits<A>::template portable_rebind_alloc
<container_detail::pair<Key, T> >::type> impl_tree_t;
impl_tree_t m_flat_tree; // flat tree representing flat_map
@@ -1111,13 +1111,13 @@ class flat_multimap
, container_detail::select1st< std::pair<Key, T> >
, std::pair<Key, T> > value_compare_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::iterator iterator_impl;
<typename allocator_traits<A>::pointer>::iterator iterator_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::const_iterator const_iterator_impl;
<typename allocator_traits<A>::pointer>::const_iterator const_iterator_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::reverse_iterator reverse_iterator_impl;
<typename allocator_traits<A>::pointer>::reverse_iterator reverse_iterator_impl;
typedef typename container_detail::get_flat_tree_iterators
<typename allocator_traits<Allocator>::pointer>::const_reverse_iterator const_reverse_iterator_impl;
<typename allocator_traits<A>::pointer>::const_reverse_iterator const_reverse_iterator_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -1130,15 +1130,15 @@ class flat_multimap
typedef Key key_type;
typedef T mapped_type;
typedef std::pair<Key, T> value_type;
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 BOOST_CONTAINER_IMPDEF(Allocator) stored_allocator_type;
typedef ::boost::container::allocator_traits<A> allocator_traits_type;
typedef typename boost::container::allocator_traits<A>::pointer pointer;
typedef typename boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<A>::reference reference;
typedef typename boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename boost::container::allocator_traits<A>::size_type size_type;
typedef typename boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_type;
typedef BOOST_CONTAINER_IMPDEF(A) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(value_compare_impl) value_compare;
typedef Compare key_compare;
typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
@@ -1159,8 +1159,8 @@ class flat_multimap
flat_multimap()
: m_flat_tree()
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison
@@ -1171,8 +1171,8 @@ class flat_multimap
const allocator_type& a = allocator_type())
: m_flat_tree(comp, container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified allocator.
@@ -1181,8 +1181,8 @@ class flat_multimap
explicit flat_multimap(const allocator_type& a)
: m_flat_tree(container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object
@@ -1196,8 +1196,8 @@ class flat_multimap
const allocator_type& a = allocator_type())
: m_flat_tree(false, first, last, comp, container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and
@@ -1215,8 +1215,8 @@ class flat_multimap
const allocator_type& a = allocator_type())
: m_flat_tree(ordered_range, first, last, comp, a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@@ -1228,8 +1228,8 @@ class flat_multimap
flat_multimap(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: m_flat_tree(false, il.begin(), il.end(), comp, container_detail::force<impl_allocator_type>(a))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and
@@ -1245,8 +1245,8 @@ class flat_multimap
const allocator_type& a = allocator_type())
: m_flat_tree(ordered_range, il.begin(), il.end(), comp, a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
#endif
@@ -1256,8 +1256,8 @@ class flat_multimap
flat_multimap(const flat_multimap& x)
: m_flat_tree(x.m_flat_tree)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a flat_multimap. Constructs *this using x's resources.
@@ -1268,8 +1268,8 @@ class flat_multimap
flat_multimap(BOOST_RV_REF(flat_multimap) x)
: m_flat_tree(boost::move(x.m_flat_tree))
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a flat_multimap using the specified allocator.
@@ -1278,8 +1278,8 @@ class flat_multimap
flat_multimap(const flat_multimap& x, const allocator_type &a)
: m_flat_tree(x.m_flat_tree, a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a flat_multimap using the specified allocator.
@@ -1289,8 +1289,8 @@ class flat_multimap
flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a)
: m_flat_tree(boost::move(x.m_flat_tree), a)
{
//Allocator type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Makes *this a copy of x.
@@ -1318,7 +1318,7 @@ class flat_multimap
}
#endif
//! <b>Effects</b>: Returns a copy of the Allocator that
//! <b>Effects</b>: Returns a copy of the allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
@@ -1833,7 +1833,7 @@ class flat_multimap
iterator lower_bound(const key_type& x)
{ return container_detail::force_copy<iterator>(m_flat_tree.lower_bound(x)); }
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key
//! <b>Returns</b>: A const iterator pointing to the first element with key
//! not less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -1847,7 +1847,7 @@ class flat_multimap
iterator upper_bound(const key_type& x)
{return container_detail::force_copy<iterator>(m_flat_tree.upper_bound(x)); }
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key
//! <b>Returns</b>: A const iterator pointing to the first element with key
//! not less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -1917,10 +1917,10 @@ namespace boost {
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class K, class T, class C, class Allocator>
struct has_trivial_destructor_after_move< boost::container::flat_multimap<K, T, C, Allocator> >
template <class K, class T, class C, class A>
struct has_trivial_destructor_after_move< boost::container::flat_multimap<K, T, C, A> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
} //namespace boost {

View File

@@ -50,21 +50,21 @@ namespace container {
//!
//! \tparam Key is the type to be inserted in the set, which is also the key_type
//! \tparam Compare is the comparison functor used to order keys
//! \tparam Allocator is the allocator to be used to allocate memory for this container
//! \tparam A is the allocator to be used to allocate memory for this container
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class Key, class Compare = std::less<Key>, class Allocator = std::allocator<Key> >
template <class Key, class Compare = std::less<Key>, class A = std::allocator<Key> >
#else
template <class Key, class Compare, class Allocator>
template <class Key, class Compare, class A>
#endif
class flat_set
///@cond
: public container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator>
: public container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, A>
///@endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(flat_set)
typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> base_t;
typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, A> base_t;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -77,14 +77,14 @@ class flat_set
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 ::boost::container::allocator_traits<A> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -241,7 +241,7 @@ class flat_set
#endif
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Effects</b>: Returns a copy of the Allocator that
//! <b>Effects</b>: Returns a copy of the allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
@@ -641,7 +641,7 @@ class flat_set
//! <b>Complexity</b>: Logarithmic.
iterator find(const key_type& x);
//! <b>Returns</b>: Allocator const_iterator pointing to an element with the key
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
@@ -713,7 +713,7 @@ class flat_set
//! <b>Complexity</b>: Logarithmic
iterator lower_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -725,7 +725,7 @@ class flat_set
//! <b>Complexity</b>: Logarithmic
iterator upper_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -802,10 +802,10 @@ class flat_set
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::flat_set<Key, C, Allocator> >
template <class Key, class C, class A>
struct has_trivial_destructor_after_move<boost::container::flat_set<Key, C, A> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value &&has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value &&has_trivial_destructor_after_move<C>::value;
};
namespace container {
@@ -827,21 +827,21 @@ namespace container {
//!
//! \tparam Key is the type to be inserted in the multiset, which is also the key_type
//! \tparam Compare is the comparison functor used to order keys
//! \tparam Allocator is the allocator to be used to allocate memory for this container
//! \tparam A is the allocator to be used to allocate memory for this container
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class Key, class Compare = std::less<Key>, class Allocator = std::allocator<Key> >
template <class Key, class Compare = std::less<Key>, class A = std::allocator<Key> >
#else
template <class Key, class Compare, class Allocator>
template <class Key, class Compare, class A>
#endif
class flat_multiset
///@cond
: public container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator>
: public container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, A>
///@endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, Allocator> base_t;
typedef container_detail::flat_tree<Key, Key, container_detail::identity<Key>, Compare, A> base_t;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -854,14 +854,14 @@ class flat_multiset
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 ::boost::container::allocator_traits<A> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -1297,10 +1297,10 @@ class flat_multiset
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, C, Allocator> >
template <class Key, class C, class A>
struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, C, A> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
namespace container {

View File

@@ -84,10 +84,10 @@ struct iiterator_node_value_type< list_node<T,VoidPointer> > {
typedef T type;
};
template<class Allocator>
template<class A>
struct intrusive_list_type
{
typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::allocator_traits<A> allocator_traits_type;
typedef typename allocator_traits_type::value_type value_type;
typedef typename boost::intrusive::pointer_traits
<typename allocator_traits_type::pointer>::template
@@ -120,20 +120,20 @@ 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 A The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = std::allocator<T> >
template <class T, class A = std::allocator<T> >
#else
template <class T, class Allocator>
template <class T, class A>
#endif
class list
: protected container_detail::node_alloc_holder
<Allocator, typename container_detail::intrusive_list_type<Allocator>::type>
<A, typename container_detail::intrusive_list_type<A>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename
container_detail::intrusive_list_type<Allocator>::type Icont;
typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder;
container_detail::intrusive_list_type<A>::type Icont;
typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef typename AllocHolder::NodeAlloc NodeAlloc;
typedef typename AllocHolder::ValAlloc ValAlloc;
@@ -142,8 +142,8 @@ class list
typedef typename AllocHolder::allocator_v1 allocator_v1;
typedef typename AllocHolder::allocator_v2 allocator_v2;
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<A> allocator_traits_type;
typedef boost::container::equal_to_value<A> equal_to_value_type;
BOOST_COPYABLE_AND_MOVABLE(list)
@@ -159,13 +159,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<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A 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;
@@ -204,7 +204,7 @@ class list
//!
//! <b>Complexity</b>: Linear to n.
explicit list(size_type n)
: AllocHolder(Allocator())
: AllocHolder(A())
{ this->resize(n); }
//! <b>Effects</b>: Constructs a list that will use a copy of allocator a
@@ -214,7 +214,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 A& a = A())
: AllocHolder(a)
{ this->insert(this->cbegin(), n, value); }
@@ -274,7 +274,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 A &a = A())
: AllocHolder(a)
{ this->insert(this->cbegin(), first, last); }
@@ -288,7 +288,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 A &a = A())
: AllocHolder(a)
{ this->insert(this->cbegin(), il.begin(), il.end()); }
#endif
@@ -1403,9 +1403,9 @@ class list
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::list<T, Allocator> >
: public ::boost::has_trivial_destructor_after_move<Allocator>
template <class T, class A>
struct has_trivial_destructor_after_move<boost::container::list<T, A> >
: public ::boost::has_trivial_destructor_after_move<A>
{};
namespace container {

View File

@@ -57,20 +57,20 @@ namespace container {
//! \tparam Key is the key_type of the map
//! \tparam Value is the <code>mapped_type</code>
//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
//! \tparam A is the allocator to allocate the <code>value_type</code>s
//! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
//! \tparam MapOptions 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 = std::allocator< std::pair< const Key, T> >, class MapOptions = tree_assoc_defaults >
, class A = std::allocator< std::pair< const Key, T> >, class MapOptions = tree_assoc_defaults >
#else
template <class Key, class T, class Compare, class Allocator, class MapOptions>
template <class Key, class T, class Compare, class A, class MapOptions>
#endif
class map
///@cond
: public container_detail::tree
< Key, std::pair<const Key, T>
, container_detail::select1st< std::pair<const Key, T> >
, Compare, Allocator, MapOptions>
, Compare, A, MapOptions>
///@endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -79,7 +79,7 @@ class map
typedef std::pair<const Key, T> value_type_impl;
typedef container_detail::tree
<Key, value_type_impl, container_detail::select1st<value_type_impl>, Compare, Allocator, MapOptions> base_t;
<Key, value_type_impl, container_detail::select1st<value_type_impl>, Compare, A, MapOptions> base_t;
typedef container_detail::pair <Key, T> movable_value_type_impl;
typedef container_detail::tree_value_compare
< Key, value_type_impl, Compare, container_detail::select1st<value_type_impl>
@@ -94,16 +94,16 @@ class map
//////////////////////////////////////////////
typedef Key key_type;
typedef ::boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef ::boost::container::allocator_traits<A> allocator_traits_type;
typedef T mapped_type;
typedef std::pair<const Key, 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<A>::pointer pointer;
typedef typename boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<A>::reference reference;
typedef typename boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename boost::container::allocator_traits<A>::size_type size_type;
typedef typename boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -126,8 +126,8 @@ class map
map()
: base_t()
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object
@@ -138,8 +138,8 @@ class map
const allocator_type& a = allocator_type())
: base_t(comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified allocator.
@@ -148,8 +148,8 @@ class map
explicit map(const allocator_type& a)
: base_t(a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
@@ -162,8 +162,8 @@ class map
const allocator_type& a = allocator_type())
: base_t(true, first, last, comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty map using the specified comparison object and
@@ -181,8 +181,8 @@ class map
, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(ordered_range, first, last, comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
@@ -194,16 +194,16 @@ class map
map(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type())
: base_t(true, il.begin(), il.end(), comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(),
const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
#endif
@@ -213,8 +213,8 @@ class map
map(const map& x)
: base_t(static_cast<const base_t&>(x))
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a map. Constructs *this using x's resources.
@@ -225,8 +225,8 @@ class map
map(BOOST_RV_REF(map) x)
: base_t(BOOST_MOVE_BASE(base_t, x))
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a map using the specified allocator.
@@ -235,8 +235,8 @@ class map
map(const map& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a map using the specified allocator.
@@ -248,8 +248,8 @@ class map
map(BOOST_RV_REF(map) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Makes *this a copy of x.
@@ -283,7 +283,7 @@ class map
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Returns a copy of the Allocator that
//! <b>Effects</b>: Returns a copy of the allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
@@ -424,7 +424,7 @@ class map
//! Effects: If there is no key equivalent to x in the map, inserts
//! value_type(x, T()) into the map.
//!
//! Returns: Allocator reference to the mapped_type corresponding to x in *this.
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
//! Complexity: Logarithmic.
mapped_type& operator[](const key_type &k);
@@ -432,7 +432,7 @@ class map
//! Effects: If there is no key equivalent to x in the map, inserts
//! value_type(boost::move(x), T()) into the map (the key is move-constructed)
//!
//! Returns: Allocator reference to the mapped_type corresponding to x in *this.
//! Returns: A reference to the mapped_type corresponding to x in *this.
//!
//! Complexity: Logarithmic.
mapped_type& operator[](key_type &&k);
@@ -440,7 +440,7 @@ class map
BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript)
#endif
//! Returns: Allocator reference to the element whose key is equivalent to x.
//! Returns: A reference to the element whose key is equivalent to x.
//! Throws: An exception object of type out_of_range if no such element is present.
//! Complexity: logarithmic.
T& at(const key_type& k)
@@ -452,7 +452,7 @@ class map
return i->second;
}
//! Returns: Allocator reference to the element whose key is equivalent to x.
//! Returns: A reference to the element whose key is equivalent to x.
//! Throws: An exception object of type out_of_range if no such element is present.
//! Complexity: logarithmic.
const T& at(const key_type& k) const
@@ -704,7 +704,7 @@ class map
//! <b>Complexity</b>: Logarithmic.
iterator find(const key_type& x);
//! <b>Returns</b>: Allocator const_iterator pointing to an element with the key
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
@@ -726,7 +726,7 @@ class map
//! <b>Complexity</b>: Logarithmic
iterator lower_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -738,7 +738,7 @@ class map
//! <b>Complexity</b>: Logarithmic
iterator upper_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -835,10 +835,10 @@ class map
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class K, class T, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::map<K, T, C, Allocator> >
template <class K, class T, class C, class A>
struct has_trivial_destructor_after_move<boost::container::map<K, T, C, A> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
namespace container {
@@ -859,20 +859,20 @@ namespace container {
//! \tparam Key is the key_type of the map
//! \tparam Value is the <code>mapped_type</code>
//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>).
//! \tparam Allocator is the allocator to allocate the <code>value_type</code>s
//! \tparam A is the allocator to allocate the <code>value_type</code>s
//! (e.g. <i>allocator< std::pair<const Key, T> > </i>).
//! \tparam MultiMapOptions 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 = std::allocator< std::pair< const Key, T> >, class MultiMapOptions = tree_assoc_defaults>
, class A = std::allocator< std::pair< const Key, T> >, class MultiMapOptions = tree_assoc_defaults>
#else
template <class Key, class T, class Compare, class Allocator, class MultiMapOptions>
template <class Key, class T, class Compare, class A, class MultiMapOptions>
#endif
class multimap
///@cond
: public container_detail::tree
< Key, std::pair<const Key, T>
, container_detail::select1st< std::pair<const Key, T> >
, Compare, Allocator, MultiMapOptions>
, Compare, A, MultiMapOptions>
///@endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -881,7 +881,7 @@ class multimap
typedef std::pair<const Key, T> value_type_impl;
typedef container_detail::tree
<Key, value_type_impl, container_detail::select1st<value_type_impl>, Compare, Allocator, MultiMapOptions> base_t;
<Key, value_type_impl, container_detail::select1st<value_type_impl>, Compare, A, MultiMapOptions> base_t;
typedef container_detail::pair <Key, T> movable_value_type_impl;
typedef container_detail::tree_value_compare
< Key, value_type_impl, Compare, container_detail::select1st<value_type_impl>
@@ -898,13 +898,13 @@ class multimap
typedef Key key_type;
typedef T mapped_type;
typedef std::pair<const Key, 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<A>::pointer pointer;
typedef typename boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename boost::container::allocator_traits<A>::reference reference;
typedef typename boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename boost::container::allocator_traits<A>::size_type size_type;
typedef typename boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -927,8 +927,8 @@ class multimap
multimap()
: base_t()
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified allocator.
@@ -937,8 +937,8 @@ class multimap
explicit multimap(const Compare& comp, const allocator_type& a = allocator_type())
: base_t(comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison
@@ -948,8 +948,8 @@ class multimap
explicit multimap(const allocator_type& a)
: base_t(a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object
@@ -963,8 +963,8 @@ class multimap
const allocator_type& a = allocator_type())
: base_t(false, first, last, comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Constructs an empty multimap using the specified comparison object and
@@ -992,16 +992,16 @@ class multimap
const allocator_type& a = allocator_type())
: base_t(false, il.begin(), il.end(), comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp = Compare(),
const allocator_type& a = allocator_type())
: base_t(ordered_range, il.begin(), il.end(), comp, a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
#endif
@@ -1011,8 +1011,8 @@ class multimap
multimap(const multimap& x)
: base_t(static_cast<const base_t&>(x))
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a multimap. Constructs *this using x's resources.
@@ -1023,8 +1023,8 @@ class multimap
multimap(BOOST_RV_REF(multimap) x)
: base_t(BOOST_MOVE_BASE(base_t, x))
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Copy constructs a multimap.
@@ -1033,8 +1033,8 @@ class multimap
multimap(const multimap& x, const allocator_type &a)
: base_t(static_cast<const base_t&>(x), a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Move constructs a multimap using the specified allocator.
@@ -1045,8 +1045,8 @@ class multimap
multimap(BOOST_RV_REF(multimap) x, const allocator_type &a)
: base_t(BOOST_MOVE_BASE(base_t, x), a)
{
//Allocator type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename Allocator::value_type>::value));
//A type must be std::pair<CONST Key, T>
BOOST_STATIC_ASSERT((container_detail::is_same<std::pair<const Key, T>, typename A::value_type>::value));
}
//! <b>Effects</b>: Makes *this a copy of x.
@@ -1294,7 +1294,7 @@ class multimap
//! <b>Complexity</b>: Logarithmic.
iterator find(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to an element with the key
//! <b>Returns</b>: A const iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
@@ -1311,7 +1311,7 @@ class multimap
//! <b>Complexity</b>: Logarithmic
iterator lower_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -1323,7 +1323,7 @@ class multimap
//! <b>Complexity</b>: Logarithmic
iterator upper_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -1388,10 +1388,10 @@ class multimap
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class K, class T, class C, class Allocator>
struct has_trivial_destructor_after_move<boost::container::multimap<K, T, C, Allocator> >
template <class K, class T, class C, class A>
struct has_trivial_destructor_after_move<boost::container::multimap<K, T, C, A> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
namespace container {

View File

@@ -48,10 +48,10 @@ namespace boost { namespace container {
//! ill-formed.
//!
//! <code>
//! template <class T, class Allocator = allocator<T> >
//! template <class T, class A = allocator<T> >
//! class Z {
//! public:
//! typedef Allocator allocator_type;
//! typedef A allocator_type;
//!
//! // Default constructor with optional allocator suffix
//! Z(const allocator_type& a = allocator_type());
@@ -62,12 +62,12 @@ namespace boost { namespace container {
//! };
//!
//! // Specialize trait for class template Z
//! template <class T, class Allocator = allocator<T> >
//! struct constructible_with_allocator_suffix<Z<T,Allocator> >
//! template <class T, class A = allocator<T> >
//! struct constructible_with_allocator_suffix<Z<T,A> >
//! : ::boost::true_type { };
//! </code>
//!
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)"
//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped A Model (Rev 2)"
//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as
//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments.
//! Applications aiming portability with several compilers should always define this trait.
@@ -92,10 +92,10 @@ struct constructible_with_allocator_suffix
//! a constructor, then the program is ill-formed.
//!
//! <code>
//! template <class T, class Allocator = allocator<T> >
//! template <class T, class A = allocator<T> >
//! class Y {
//! public:
//! typedef Allocator allocator_type;
//! typedef A allocator_type;
//!
//! // Default constructor with and allocator-extended default constructor
//! Y();
@@ -112,8 +112,8 @@ struct constructible_with_allocator_suffix
//! };
//!
//! // Specialize trait for class template Y
//! template <class T, class Allocator = allocator<T> >
//! struct constructible_with_allocator_prefix<Y<T,Allocator> >
//! template <class T, class A = allocator<T> >
//! struct constructible_with_allocator_prefix<Y<T,A> >
//! : ::boost::true_type { };
//!
//! </code>
@@ -1103,16 +1103,16 @@ class scoped_allocator_adaptor
typedef typename outer_traits_type::const_pointer const_pointer;
typedef typename outer_traits_type::void_pointer void_pointer;
typedef typename outer_traits_type::const_void_pointer const_void_pointer;
//! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_copy_assignment::value</code> is
//! true for any <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
//! Type: <code>true_type</code> if <code>allocator_traits<A>::propagate_on_container_copy_assignment::value</code> is
//! true for any <code>A</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type::
propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
//! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_move_assignment::value</code> is
//! true for any <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
//! Type: <code>true_type</code> if <code>allocator_traits<A>::propagate_on_container_move_assignment::value</code> is
//! true for any <code>A</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type::
propagate_on_container_move_assignment propagate_on_container_move_assignment;
//! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_swap::value</code> is true for any
//! <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
//! Type: <code>true_type</code> if <code>allocator_traits<A>::propagate_on_container_swap::value</code> is true for any
//! <code>A</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type::
propagate_on_container_swap propagate_on_container_swap;
@@ -1280,9 +1280,9 @@ class scoped_allocator_adaptor
}
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator
//! <b>Returns</b>: A new scoped_allocator_adaptor object where each allocator
//! A in the adaptor is initialized from the result of calling
//! <code>allocator_traits<Allocator>::select_on_container_copy_construction()</code> on
//! <code>allocator_traits<A>::select_on_container_copy_construction()</code> on
//! the corresponding allocator in *this.
scoped_allocator_adaptor select_on_container_copy_construction() const;
#endif //BOOST_CONTAINER_DOXYGEN_INVOKED

View File

@@ -64,7 +64,7 @@ class scoped_allocator_adaptor;
//! The allocator_arg_t struct is an empty structure type used as a unique type to
//! disambiguate constructor and function overloading. Specifically, several types
//! have constructors with allocator_arg_t as the first argument, immediately followed
//! by an argument of a type that satisfies the Allocator requirements
//! by an argument of a type that satisfies Allocator requirements
struct allocator_arg_t{};
//! A instance of type allocator_arg_t

View File

@@ -51,23 +51,23 @@ namespace container {
//!
//! \tparam Key is the type to be inserted in the set, which is also the key_type
//! \tparam Compare is the comparison functor used to order keys
//! \tparam Allocator is the allocator to be used to allocate memory for this container
//! \tparam A is the allocator to be used to allocate memory for this container
//! \tparam SetOptions is an packed option type generated using using boost::container::tree_assoc_options.
template <class Key, class Compare = std::less<Key>, class Allocator = std::allocator<Key>, class SetOptions = tree_assoc_defaults >
template <class Key, class Compare = std::less<Key>, class A = std::allocator<Key>, class SetOptions = tree_assoc_defaults >
#else
template <class Key, class Compare, class Allocator, class SetOptions>
template <class Key, class Compare, class A, class SetOptions>
#endif
class set
///@cond
: public container_detail::tree
< Key, Key, container_detail::identity<Key>, Compare, Allocator, SetOptions>
< Key, Key, container_detail::identity<Key>, Compare, A, SetOptions>
///@endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(set)
typedef container_detail::tree
< Key, Key, container_detail::identity<Key>, Compare, Allocator, SetOptions> base_t;
< Key, Key, container_detail::identity<Key>, Compare, A, SetOptions> base_t;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -80,14 +80,14 @@ class set
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 ::boost::container::allocator_traits<A> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -235,7 +235,7 @@ class set
#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Returns a copy of the Allocator that
//! <b>Effects</b>: Returns a copy of the allocator that
//! was passed to the object's constructor.
//!
//! <b>Complexity</b>: Constant.
@@ -548,7 +548,7 @@ class set
//! <b>Complexity</b>: Logarithmic.
iterator find(const key_type& x);
//! <b>Returns</b>: Allocator const_iterator pointing to an element with the key
//! <b>Returns</b>: A const_iterator pointing to an element with the key
//! equivalent to x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic.
@@ -576,7 +576,7 @@ class set
//! <b>Complexity</b>: Logarithmic
iterator lower_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than k, or a.end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -588,7 +588,7 @@ class set
//! <b>Complexity</b>: Logarithmic
iterator upper_bound(const key_type& x);
//! <b>Returns</b>: Allocator const iterator pointing to the first element with key not
//! <b>Returns</b>: A const iterator pointing to the first element with key not
//! less than x, or end() if such an element is not found.
//!
//! <b>Complexity</b>: Logarithmic
@@ -680,10 +680,10 @@ class set
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class C, class SetOptions, class Allocator>
struct has_trivial_destructor_after_move<boost::container::set<Key, C, Allocator, SetOptions> >
template <class Key, class C, class SetOptions, class A>
struct has_trivial_destructor_after_move<boost::container::set<Key, C, A, SetOptions> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
namespace container {
@@ -702,23 +702,23 @@ namespace container {
//!
//! \tparam Key is the type to be inserted in the set, which is also the key_type
//! \tparam Compare is the comparison functor used to order keys
//! \tparam Allocator is the allocator to be used to allocate memory for this container
//! \tparam A is the allocator to be used to allocate memory for this container
//! \tparam MultiSetOptions is an packed option type generated using using boost::container::tree_assoc_options.
template <class Key, class Compare = std::less<Key>, class Allocator = std::allocator<Key>, class MultiSetOptions = tree_assoc_defaults >
template <class Key, class Compare = std::less<Key>, class A = std::allocator<Key>, class MultiSetOptions = tree_assoc_defaults >
#else
template <class Key, class Compare, class Allocator, class MultiSetOptions>
template <class Key, class Compare, class A, class MultiSetOptions>
#endif
class multiset
/// @cond
: public container_detail::tree
<Key, Key,container_detail::identity<Key>, Compare, Allocator, MultiSetOptions>
<Key, Key,container_detail::identity<Key>, Compare, A, MultiSetOptions>
/// @endcond
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(multiset)
typedef container_detail::tree
<Key, Key,container_detail::identity<Key>, Compare, Allocator, MultiSetOptions> base_t;
<Key, Key,container_detail::identity<Key>, Compare, A, MultiSetOptions> base_t;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -732,14 +732,14 @@ class multiset
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 ::boost::container::allocator_traits<A> allocator_traits_type;
typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_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;
@@ -1108,10 +1108,10 @@ class multiset
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class Key, class C, class Allocator, class MultiSetOptions>
struct has_trivial_destructor_after_move<boost::container::multiset<Key, C, Allocator, MultiSetOptions> >
template <class Key, class C, class A, class MultiSetOptions>
struct has_trivial_destructor_after_move<boost::container::multiset<Key, C, A, MultiSetOptions> >
{
static const bool value = has_trivial_destructor_after_move<Allocator>::value && has_trivial_destructor_after_move<C>::value;
static const bool value = has_trivial_destructor_after_move<A>::value && has_trivial_destructor_after_move<C>::value;
};
namespace container {

View File

@@ -57,7 +57,7 @@ namespace container {
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator>
template <class T, class A>
class slist;
namespace container_detail {
@@ -94,10 +94,10 @@ struct iiterator_node_value_type< slist_node<T,VoidPointer> > {
typedef T type;
};
template<class Allocator>
template<class A>
struct intrusive_slist_type
{
typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::allocator_traits<A> allocator_traits_type;
typedef typename allocator_traits_type::value_type value_type;
typedef typename boost::intrusive::pointer_traits
<typename allocator_traits_type::pointer>::template
@@ -154,20 +154,20 @@ 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 A The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = std::allocator<T> >
template <class T, class A = std::allocator<T> >
#else
template <class T, class Allocator>
template <class T, class A>
#endif
class slist
: protected container_detail::node_alloc_holder
<Allocator, typename container_detail::intrusive_slist_type<Allocator>::type>
<A, typename container_detail::intrusive_slist_type<A>::type>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename
container_detail::intrusive_slist_type<Allocator>::type Icont;
typedef container_detail::node_alloc_holder<Allocator, Icont> AllocHolder;
container_detail::intrusive_slist_type<A>::type Icont;
typedef container_detail::node_alloc_holder<A, Icont> AllocHolder;
typedef typename AllocHolder::NodePtr NodePtr;
typedef typename AllocHolder::NodeAlloc NodeAlloc;
typedef typename AllocHolder::ValAlloc ValAlloc;
@@ -177,8 +177,8 @@ class slist
typedef typename AllocHolder::allocator_v2 allocator_v2;
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<A> allocator_traits_type;
typedef boost::container::equal_to_value<A> equal_to_value_type;
BOOST_COPYABLE_AND_MOVABLE(slist)
typedef container_detail::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl;
@@ -193,13 +193,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<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A 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;
@@ -1631,9 +1631,9 @@ namespace boost {
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::slist<T, Allocator> >
: public ::boost::has_trivial_destructor_after_move<Allocator>
template <class T, class A>
struct has_trivial_destructor_after_move<boost::container::slist<T, A> >
: public ::boost::has_trivial_destructor_after_move<A>
{};
namespace container {
@@ -1651,11 +1651,11 @@ namespace container {
//there is no other way
namespace std {
template <class T, class Allocator>
class insert_iterator<boost::container::slist<T, Allocator> >
template <class T, class A>
class insert_iterator<boost::container::slist<T, A> >
{
protected:
typedef boost::container::slist<T, Allocator> Container;
typedef boost::container::slist<T, A> Container;
Container* container;
typename Container::iterator iter;
public:

View File

@@ -407,16 +407,16 @@ class stable_vector_iterator
//! operations provide stronger exception safety guarantees than in std::vector.
//!
//! \tparam T The type of object that is stored in the stable_vector
//! \tparam Allocator The allocator used for all internal memory management
//! \tparam A The allocator used for all internal memory management
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class T, class Allocator = std::allocator<T> >
template <class T, class A = std::allocator<T> >
#else
template <class T, class Allocator>
template <class T, class A>
#endif
class stable_vector
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef allocator_traits<Allocator> allocator_traits_type;
typedef allocator_traits<A> allocator_traits_type;
typedef boost::intrusive::
pointer_traits
<typename allocator_traits_type::pointer> ptr_traits;
@@ -458,7 +458,7 @@ class stable_vector
integral_constant<unsigned, 2> allocator_v2;
typedef ::boost::container::container_detail::integral_constant
<unsigned, boost::container::container_detail::
version<Allocator>::value> alloc_version;
version<A>::value> alloc_version;
typedef typename allocator_traits_type::
template portable_rebind_alloc
<node_type>::type node_allocator_type;
@@ -481,10 +481,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<A>::pointer
, false> iterator_impl;
typedef stable_vector_iterator
< typename allocator_traits<Allocator>::pointer
< typename allocator_traits<A>::pointer
, false> const_iterator_impl;
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
public:
@@ -495,13 +495,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<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A 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;
@@ -2003,9 +2003,9 @@ class stable_vector
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::stable_vector<T, Allocator> >
: public has_trivial_destructor_after_move<Allocator>::value
template <class T, class A>
struct has_trivial_destructor_after_move<boost::container::stable_vector<T, A> >
: public has_trivial_destructor_after_move<A>::value
{};
*/

View File

@@ -68,15 +68,15 @@ namespace container_detail {
// memory. The destructor assumes that the memory either is the internal buffer,
// or else points to a block of memory that was allocated using string_base's
// allocator and whose size is this->m_storage.
template <class Allocator>
template <class A>
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;
typedef allocator_traits<A> allocator_traits_type;
public:
typedef Allocator allocator_type;
typedef A allocator_type;
typedef allocator_type stored_allocator_type;
typedef typename allocator_traits_type::pointer pointer;
typedef typename allocator_traits_type::value_type value_type;
@@ -192,24 +192,24 @@ class basic_string_base
};
struct members_holder
: public Allocator
: public A
{
members_holder()
: Allocator()
: A()
{}
template<class AllocatorConvertible>
explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a)
: Allocator(boost::forward<AllocatorConvertible>(a))
: A(boost::forward<AllocatorConvertible>(a))
{}
repr_t m_repr;
} members_;
const Allocator &alloc() const
const A &alloc() const
{ return members_; }
Allocator &alloc()
A &alloc()
{ return members_; }
static const size_type InternalBufferChars = (sizeof(repr_t) - ShortDataOffset)/sizeof(value_type);
@@ -253,7 +253,7 @@ class basic_string_base
typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
typedef container_detail::integral_constant<unsigned,
boost::container::container_detail::version<Allocator>::value> alloc_version;
boost::container::container_detail::version<A>::value> alloc_version;
std::pair<pointer, bool>
allocation_command(allocation_type command,
@@ -265,7 +265,7 @@ class basic_string_base
reuse = pointer();
command &= ~(expand_fwd | expand_bwd);
}
return container_detail::allocator_version_traits<Allocator>::allocation_command
return container_detail::allocator_version_traits<A>::allocation_command
(this->alloc(), command, limit_size, preferred_size, received_size, reuse);
}
@@ -475,24 +475,24 @@ class basic_string_base
//!
//! \tparam CharT The type of character it contains.
//! \tparam Traits The Character Traits type, which encapsulates basic character operations
//! \tparam Allocator The allocator, used for internal memory management.
//! \tparam A The allocator, used for internal memory management.
#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits = std::char_traits<CharT>, class Allocator = std::allocator<CharT> >
template <class CharT, class Traits = std::char_traits<CharT>, class A = std::allocator<CharT> >
#else
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
#endif
class basic_string
: private container_detail::basic_string_base<Allocator>
: private container_detail::basic_string_base<A>
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
typedef allocator_traits<Allocator> allocator_traits_type;
typedef allocator_traits<A> allocator_traits_type;
BOOST_COPYABLE_AND_MOVABLE(basic_string)
typedef container_detail::basic_string_base<Allocator> base_t;
typedef container_detail::basic_string_base<A> base_t;
static const typename base_t::size_type InternalBufferChars = base_t::InternalBufferChars;
protected:
// Allocator helper class to use a char_traits as a function object.
// A helper class to use a char_traits as a function object.
template <class Tr>
struct Eq_traits
@@ -535,13 +535,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 ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_type;
typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type;
typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
@@ -1907,7 +1907,7 @@ class basic_string
//! <b>Requires</b>: The program shall not alter any of the values stored in the character array.
//!
//! <b>Returns</b>: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()].
//! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
//!
//! <b>Complexity</b>: constant time.
const CharT* c_str() const BOOST_CONTAINER_NOEXCEPT
@@ -1915,7 +1915,7 @@ class basic_string
//! <b>Requires</b>: The program shall not alter any of the values stored in the character array.
//!
//! <b>Returns</b>: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()].
//! <b>Returns</b>: A pointer p such that p + i == &operator[](i) for each i in [0,size()].
//!
//! <b>Complexity</b>: constant time.
const CharT* data() const BOOST_CONTAINER_NOEXCEPT
@@ -1941,7 +1941,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,A>(s,n),pos).
size_type find(const CharT* s, size_type pos, size_type n) const
{
if (pos + n > this->size())
@@ -1967,7 +1967,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,A>(1,c), pos).
size_type find(CharT c, size_type pos = 0) const
{
const size_type sz = this->size();
@@ -2027,7 +2027,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,A>(1,c),pos).
size_type rfind(CharT c, size_type pos = npos) const
{
const size_type len = this->size();
@@ -2084,7 +2084,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,A>(1,c), pos).
size_type find_first_of(CharT c, size_type pos = 0) const
{ return find(c, pos); }
@@ -2123,7 +2123,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,A>(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)); }
@@ -2250,7 +2250,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,A>(data()+pos,rlen).
basic_string substr(size_type pos = 0, size_type n = npos) const
{
if (pos > this->size())
@@ -2538,12 +2538,12 @@ wstring;
// Operator+
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT,Traits,Allocator>
operator+(const basic_string<CharT,Traits,Allocator>& x
,const basic_string<CharT,Traits,Allocator>& y)
template <class CharT, class Traits, class A> inline
basic_string<CharT,Traits,A>
operator+(const basic_string<CharT,Traits,A>& x
,const basic_string<CharT,Traits,A>& y)
{
typedef basic_string<CharT,Traits,Allocator> str_t;
typedef basic_string<CharT,Traits,A> str_t;
typedef typename str_t::reserve_t reserve_t;
reserve_t reserve;
str_t result(reserve, x.size() + y.size(), x.get_stored_allocator());
@@ -2552,60 +2552,60 @@ template <class CharT, class Traits, class Allocator> inline
return result;
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT, Traits, Allocator> operator+
( BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END x
, BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END y)
template <class CharT, class Traits, class A> inline
basic_string<CharT, Traits, A> operator+
( BOOST_RV_REF_BEG basic_string<CharT, Traits, A> BOOST_RV_REF_END x
, BOOST_RV_REF_BEG basic_string<CharT, Traits, A> BOOST_RV_REF_END y)
{
x += y;
return boost::move(x);
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT, Traits, Allocator> operator+
( BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END x
, const basic_string<CharT,Traits,Allocator>& y)
template <class CharT, class Traits, class A> inline
basic_string<CharT, Traits, A> operator+
( BOOST_RV_REF_BEG basic_string<CharT, Traits, A> BOOST_RV_REF_END x
, const basic_string<CharT,Traits,A>& y)
{
x += y;
return boost::move(x);
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT, Traits, Allocator> operator+
(const basic_string<CharT,Traits,Allocator>& x
,BOOST_RV_REF_BEG basic_string<CharT, Traits, Allocator> BOOST_RV_REF_END y)
template <class CharT, class Traits, class A> inline
basic_string<CharT, Traits, A> operator+
(const basic_string<CharT,Traits,A>& x
,BOOST_RV_REF_BEG basic_string<CharT, Traits, A> BOOST_RV_REF_END y)
{
y.insert(y.begin(), x.begin(), x.end());
return boost::move(y);
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT, Traits, Allocator> operator+
(const CharT* s, basic_string<CharT, Traits, Allocator> y)
template <class CharT, class Traits, class A> inline
basic_string<CharT, Traits, A> operator+
(const CharT* s, basic_string<CharT, Traits, A> y)
{
y.insert(y.begin(), s, s + Traits::length(s));
return y;
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT,Traits,Allocator> operator+
(basic_string<CharT,Traits,Allocator> x, const CharT* s)
template <class CharT, class Traits, class A> inline
basic_string<CharT,Traits,A> operator+
(basic_string<CharT,Traits,A> x, const CharT* s)
{
x += s;
return x;
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT,Traits,Allocator> operator+
(CharT c, basic_string<CharT,Traits,Allocator> y)
template <class CharT, class Traits, class A> inline
basic_string<CharT,Traits,A> operator+
(CharT c, basic_string<CharT,Traits,A> y)
{
y.insert(y.begin(), c);
return y;
}
template <class CharT, class Traits, class Allocator> inline
basic_string<CharT,Traits,Allocator> operator+
(basic_string<CharT,Traits,Allocator> x, const CharT c)
template <class CharT, class Traits, class A> inline
basic_string<CharT,Traits,A> operator+
(basic_string<CharT,Traits,A> x, const CharT c)
{
x += c;
return x;
@@ -2613,137 +2613,137 @@ template <class CharT, class Traits, class Allocator> inline
// Operator== and operator!=
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator==(const basic_string<CharT,Traits,Allocator>& x,
const basic_string<CharT,Traits,Allocator>& y)
operator==(const basic_string<CharT,Traits,A>& x,
const basic_string<CharT,Traits,A>& y)
{
return x.size() == y.size() &&
Traits::compare(x.data(), y.data(), x.size()) == 0;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator==(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
operator==(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
typename basic_string<CharT,Traits,Allocator>::size_type n = Traits::length(s);
typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
return n == y.size() && Traits::compare(s, y.data(), n) == 0;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator==(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
operator==(const basic_string<CharT,Traits,A>& x, const CharT* s)
{
typename basic_string<CharT,Traits,Allocator>::size_type n = Traits::length(s);
typename basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
return x.size() == n && Traits::compare(x.data(), s, n) == 0;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator!=(const basic_string<CharT,Traits,Allocator>& x,
const basic_string<CharT,Traits,Allocator>& y)
operator!=(const basic_string<CharT,Traits,A>& x,
const basic_string<CharT,Traits,A>& y)
{ return !(x == y); }
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator!=(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
operator!=(const CharT* s, const basic_string<CharT,Traits,A>& y)
{ return !(s == y); }
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator!=(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
operator!=(const basic_string<CharT,Traits,A>& x, const CharT* s)
{ return !(x == s); }
// Operator< (and also >, <=, and >=).
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator<(const basic_string<CharT,Traits,Allocator>& x, const basic_string<CharT,Traits,Allocator>& y)
operator<(const basic_string<CharT,Traits,A>& x, const basic_string<CharT,Traits,A>& y)
{
return x.compare(y) < 0;
// return basic_string<CharT,Traits,Allocator>
// return basic_string<CharT,Traits,A>
// ::s_compare(x.begin(), x.end(), y.begin(), y.end()) < 0;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator<(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
operator<(const CharT* s, const basic_string<CharT,Traits,A>& y)
{
return y.compare(s) > 0;
// basic_string<CharT,Traits,Allocator>::size_type n = Traits::length(s);
// return basic_string<CharT,Traits,Allocator>
// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
// return basic_string<CharT,Traits,A>
// ::s_compare(s, s + n, y.begin(), y.end()) < 0;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator<(const basic_string<CharT,Traits,Allocator>& x,
operator<(const basic_string<CharT,Traits,A>& x,
const CharT* s)
{
return x.compare(s) < 0;
// basic_string<CharT,Traits,Allocator>::size_type n = Traits::length(s);
// return basic_string<CharT,Traits,Allocator>
// basic_string<CharT,Traits,A>::size_type n = Traits::length(s);
// return basic_string<CharT,Traits,A>
// ::s_compare(x.begin(), x.end(), s, s + n) < 0;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator>(const basic_string<CharT,Traits,Allocator>& x,
const basic_string<CharT,Traits,Allocator>& y) {
operator>(const basic_string<CharT,Traits,A>& x,
const basic_string<CharT,Traits,A>& y) {
return y < x;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator>(const CharT* s, const basic_string<CharT,Traits,Allocator>& y) {
operator>(const CharT* s, const basic_string<CharT,Traits,A>& y) {
return y < s;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator>(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
operator>(const basic_string<CharT,Traits,A>& x, const CharT* s)
{
return s < x;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator<=(const basic_string<CharT,Traits,Allocator>& x,
const basic_string<CharT,Traits,Allocator>& y)
operator<=(const basic_string<CharT,Traits,A>& x,
const basic_string<CharT,Traits,A>& y)
{
return !(y < x);
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator<=(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
operator<=(const CharT* s, const basic_string<CharT,Traits,A>& y)
{ return !(y < s); }
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator<=(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
operator<=(const basic_string<CharT,Traits,A>& x, const CharT* s)
{ return !(s < x); }
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator>=(const basic_string<CharT,Traits,Allocator>& x,
const basic_string<CharT,Traits,Allocator>& y)
operator>=(const basic_string<CharT,Traits,A>& x,
const basic_string<CharT,Traits,A>& y)
{ return !(x < y); }
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator>=(const CharT* s, const basic_string<CharT,Traits,Allocator>& y)
operator>=(const CharT* s, const basic_string<CharT,Traits,A>& y)
{ return !(s < y); }
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline bool
operator>=(const basic_string<CharT,Traits,Allocator>& x, const CharT* s)
operator>=(const basic_string<CharT,Traits,A>& x, const CharT* s)
{ return !(x < s); }
// Swap.
template <class CharT, class Traits, class Allocator>
inline void swap(basic_string<CharT,Traits,Allocator>& x, basic_string<CharT,Traits,Allocator>& y)
template <class CharT, class Traits, class A>
inline void swap(basic_string<CharT,Traits,A>& x, basic_string<CharT,Traits,A>& y)
{ x.swap(y); }
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
@@ -2768,17 +2768,17 @@ string_fill(std::basic_ostream<CharT, Traits>& os,
} //namespace container_detail {
#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
std::basic_ostream<CharT, Traits>&
operator<<(std::basic_ostream<CharT, Traits>& os, const basic_string<CharT,Traits,Allocator>& s)
operator<<(std::basic_ostream<CharT, Traits>& os, const basic_string<CharT,Traits,A>& s)
{
typename std::basic_ostream<CharT, Traits>::sentry sentry(os);
bool ok = false;
if (sentry) {
ok = true;
typename basic_string<CharT,Traits,Allocator>::size_type n = s.size();
typename basic_string<CharT,Traits,Allocator>::size_type pad_len = 0;
typename basic_string<CharT,Traits,A>::size_type n = s.size();
typename basic_string<CharT,Traits,A>::size_type pad_len = 0;
const bool left = (os.flags() & std::ios::left) != 0;
const std::size_t w = os.width(0);
std::basic_streambuf<CharT, Traits>* buf = os.rdbuf();
@@ -2803,9 +2803,9 @@ operator<<(std::basic_ostream<CharT, Traits>& os, const basic_string<CharT,Trait
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
std::basic_istream<CharT, Traits>&
operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allocator>& s)
operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,A>& s)
{
typename std::basic_istream<CharT, Traits>::sentry sentry(is);
@@ -2850,11 +2850,11 @@ operator>>(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allo
return is;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
std::basic_istream<CharT, Traits>&
getline(std::istream& is, basic_string<CharT,Traits,Allocator>& s,CharT delim)
getline(std::istream& is, basic_string<CharT,Traits,A>& s,CharT delim)
{
typename basic_string<CharT,Traits,Allocator>::size_type nread = 0;
typename basic_string<CharT,Traits,A>::size_type nread = 0;
typename std::basic_istream<CharT, Traits>::sentry sentry(is, true);
if (sentry) {
std::basic_streambuf<CharT, Traits>* buf = is.rdbuf();
@@ -2882,15 +2882,15 @@ getline(std::istream& is, basic_string<CharT,Traits,Allocator>& s,CharT delim)
return is;
}
template <class CharT, class Traits, class Allocator>
template <class CharT, class Traits, class A>
inline std::basic_istream<CharT, Traits>&
getline(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,Allocator>& s)
getline(std::basic_istream<CharT, Traits>& is, basic_string<CharT,Traits,A>& s)
{
return getline(is, s, '\n');
}
template <class Ch, class Allocator>
inline std::size_t hash_value(basic_string<Ch, std::char_traits<Ch>, Allocator> const& v)
template <class Ch, class A>
inline std::size_t hash_value(basic_string<Ch, std::char_traits<Ch>, A> const& v)
{
return hash_range(v.begin(), v.end());
}
@@ -2906,9 +2906,9 @@ struct has_trivial_destructor_after_move;
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class C, class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::basic_string<C, T, Allocator> >
: public ::boost::has_trivial_destructor_after_move<Allocator>
template <class C, class T, class A>
struct has_trivial_destructor_after_move<boost::container::basic_string<C, T, A> >
: public ::boost::has_trivial_destructor_after_move<A>
{};
}

View File

@@ -239,54 +239,54 @@ struct vector_value_traits_base
};
template <class Allocator>
template <class A>
struct vector_value_traits
: public vector_value_traits_base<typename Allocator::value_type>
: public vector_value_traits_base<typename A::value_type>
{
typedef vector_value_traits_base<typename Allocator::value_type> base_t;
typedef vector_value_traits_base<typename A::value_type> base_t;
//This is the anti-exception array destructor
//to deallocate values already constructed
typedef typename container_detail::if_c
<base_t::trivial_dctr
,container_detail::null_scoped_destructor_n<Allocator>
,container_detail::scoped_destructor_n<Allocator>
,container_detail::null_scoped_destructor_n<A>
,container_detail::scoped_destructor_n<A>
>::type ArrayDestructor;
//This is the anti-exception array deallocator
typedef container_detail::scoped_array_deallocator<Allocator> ArrayDeallocator;
typedef container_detail::scoped_array_deallocator<A> ArrayDeallocator;
};
//!This struct deallocates and allocated memory
template < class Allocator
, class AllocatorVersion = typename container_detail::version<Allocator>::type
template < class A
, class AllocatorVersion = typename container_detail::version<A>::type
>
struct vector_alloc_holder
: public Allocator
: public A
{
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder)
public:
typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::allocator_traits<A> allocator_traits_type;
typedef typename allocator_traits_type::pointer pointer;
typedef typename allocator_traits_type::size_type size_type;
typedef typename allocator_traits_type::value_type value_type;
//Constructor, does not throw
vector_alloc_holder()
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value)
: Allocator(), m_start(), m_size(), m_capacity()
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
: A(), m_start(), m_size(), m_capacity()
{}
//Constructor, does not throw
template<class AllocConvertible>
explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT
: Allocator(boost::forward<AllocConvertible>(a)), m_start(), m_size(), m_capacity()
: A(boost::forward<AllocConvertible>(a)), m_start(), m_size(), m_capacity()
{}
//Constructor, does not throw
template<class AllocConvertible>
vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size)
: Allocator(boost::forward<AllocConvertible>(a))
: A(boost::forward<AllocConvertible>(a))
, m_start()
, m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
, m_capacity()
@@ -298,7 +298,7 @@ struct vector_alloc_holder
//Constructor, does not throw
vector_alloc_holder(uninitialized_size_t, size_type initial_size)
: Allocator()
: A()
, m_start()
, m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
, m_capacity()
@@ -310,7 +310,7 @@ struct vector_alloc_holder
}
vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder) BOOST_CONTAINER_NOEXCEPT
: Allocator(BOOST_MOVE_BASE(Allocator, holder))
: A(BOOST_MOVE_BASE(A, holder))
, m_start(holder.m_start)
, m_size(holder.m_size)
, m_capacity(holder.m_capacity)
@@ -346,7 +346,7 @@ struct vector_alloc_holder
size_type preferred_size,
size_type &received_size, const pointer &reuse = pointer())
{
return allocator_version_traits<Allocator>::allocation_command
return allocator_version_traits<A>::allocation_command
(this->alloc(), command, limit_size, preferred_size, received_size, reuse);
}
@@ -378,10 +378,10 @@ struct vector_alloc_holder
x.m_size = x.m_capacity = 0;
}
Allocator &alloc() BOOST_CONTAINER_NOEXCEPT
A &alloc() BOOST_CONTAINER_NOEXCEPT
{ return *this; }
const Allocator &alloc() const BOOST_CONTAINER_NOEXCEPT
const A &alloc() const BOOST_CONTAINER_NOEXCEPT
{ return *this; }
const pointer &start() const BOOST_CONTAINER_NOEXCEPT { return m_start; }
@@ -391,15 +391,15 @@ struct vector_alloc_holder
};
//!This struct deallocates and allocated memory
template <class Allocator>
struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsigned, 0> >
: public Allocator
template <class A>
struct vector_alloc_holder<A, container_detail::integral_constant<unsigned, 0> >
: public A
{
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder)
public:
typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
typedef boost::container::allocator_traits<A> allocator_traits_type;
typedef typename allocator_traits_type::pointer pointer;
typedef typename allocator_traits_type::size_type size_type;
typedef typename allocator_traits_type::value_type value_type;
@@ -409,20 +409,20 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
//Constructor, does not throw
vector_alloc_holder()
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value)
: Allocator(), m_size()
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
: A(), m_size()
{}
//Constructor, does not throw
template<class AllocConvertible>
explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT
: Allocator(boost::forward<AllocConvertible>(a)), m_size()
: A(boost::forward<AllocConvertible>(a)), m_size()
{}
//Constructor, does not throw
template<class AllocConvertible>
vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size)
: Allocator(boost::forward<AllocConvertible>(a))
: A(boost::forward<AllocConvertible>(a))
, m_size(initial_size) //Size is initialized here...
{
//... and capacity here, so vector, must call uninitialized_xxx in the derived constructor
@@ -431,7 +431,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
//Constructor, does not throw
vector_alloc_holder(uninitialized_size_t, size_type initial_size)
: Allocator()
: A()
, m_size(initial_size) //Size is initialized here...
{
//... and capacity here, so vector, must call uninitialized_xxx in the derived constructor
@@ -439,7 +439,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
}
vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder)
: Allocator(BOOST_MOVE_BASE(Allocator, holder))
: A(BOOST_MOVE_BASE(A, holder))
, m_size(holder.m_size) //Size is initialized here so vector should only call uninitialized_xxx after this
{
::boost::container::uninitialized_move_alloc_n
@@ -448,7 +448,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
template<class OtherAllocator, class OtherAllocatorVersion>
vector_alloc_holder(BOOST_RV_REF_BEG vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> BOOST_RV_REF_END holder)
: Allocator()
: A()
, m_size(holder.m_size) //Initialize it to m_size as first_allocation can only succeed or abort
{
//Different allocator type so we must check we have enough storage
@@ -460,7 +460,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
void first_allocation(size_type cap)
{
if(cap > Allocator::internal_capacity){
if(cap > A::internal_capacity){
throw_bad_alloc();
}
}
@@ -480,7 +480,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
template<class OtherAllocator, class OtherAllocatorVersion>
void swap(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x)
{
if(this->m_size > OtherAllocator::internal_capacity || x.m_size > Allocator::internal_capacity){
if(this->m_size > OtherAllocator::internal_capacity || x.m_size > A::internal_capacity){
throw_bad_alloc();
}
this->priv_swap_members_impl(x);
@@ -491,14 +491,14 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
throw_bad_alloc();
}
Allocator &alloc() BOOST_CONTAINER_NOEXCEPT
A &alloc() BOOST_CONTAINER_NOEXCEPT
{ return *this; }
const Allocator &alloc() const BOOST_CONTAINER_NOEXCEPT
const A &alloc() const BOOST_CONTAINER_NOEXCEPT
{ return *this; }
pointer start() const BOOST_CONTAINER_NOEXCEPT { return Allocator::internal_storage(); }
size_type capacity() const BOOST_CONTAINER_NOEXCEPT { return Allocator::internal_capacity; }
pointer start() const BOOST_CONTAINER_NOEXCEPT { return A::internal_storage(); }
size_type capacity() const BOOST_CONTAINER_NOEXCEPT { return A::internal_capacity; }
size_type m_size;
private:
@@ -506,7 +506,7 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
template<class OtherAllocator, class OtherAllocatorVersion>
void priv_swap_members_impl(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x)
{
const size_type MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity;
const size_type MaxTmpStorage = sizeof(value_type)*A::internal_capacity;
value_type *const first_this = container_detail::to_raw_pointer(this->start());
value_type *const first_x = container_detail::to_raw_pointer(x.start());
@@ -530,21 +530,21 @@ struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsign
//! elements in a vector may vary dynamically; memory management is automatic.
//!
//! \tparam T The type of object that is stored in the vector
//! \tparam Allocator The allocator used for all internal memory management
template <class T, class Allocator BOOST_CONTAINER_DOCONLY(= std::allocator<T>) >
//! \tparam A The allocator used for all internal memory management
template <class T, class A BOOST_CONTAINER_DOCONLY(= std::allocator<T>) >
class vector
{
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef typename container_detail::version<Allocator>::type alloc_version;
typedef typename container_detail::version<A>::type alloc_version;
boost::container::container_detail::vector_alloc_holder
<Allocator, alloc_version> m_holder;
typedef allocator_traits<Allocator> allocator_traits_type;
<A, alloc_version> m_holder;
typedef allocator_traits<A> allocator_traits_type;
template <class U, class UAllocator>
friend class vector;
typedef typename ::boost::container::allocator_traits
<Allocator>::pointer pointer_impl;
<A>::pointer pointer_impl;
typedef container_detail::vec_iterator<pointer_impl, false> iterator_impl;
typedef container_detail::vec_iterator<pointer_impl, true > const_iterator_impl;
@@ -557,14 +557,14 @@ class 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 Allocator stored_allocator_type;
typedef typename ::boost::container::allocator_traits<A>::pointer pointer;
typedef typename ::boost::container::allocator_traits<A>::const_pointer const_pointer;
typedef typename ::boost::container::allocator_traits<A>::reference reference;
typedef typename ::boost::container::allocator_traits<A>::const_reference const_reference;
typedef typename ::boost::container::allocator_traits<A>::size_type size_type;
typedef typename ::boost::container::allocator_traits<A>::difference_type difference_type;
typedef A allocator_type;
typedef A stored_allocator_type;
#if defined BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
@@ -578,7 +578,7 @@ class vector
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
BOOST_COPYABLE_AND_MOVABLE(vector)
typedef container_detail::vector_value_traits<Allocator> value_traits;
typedef container_detail::vector_value_traits<A> value_traits;
typedef container_detail::integral_constant<unsigned, 0> allocator_v0;
typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
@@ -600,7 +600,7 @@ class vector
//!
//! <b>Complexity</b>: Constant.
vector()
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value)
BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<A>::value)
: m_holder()
{}
@@ -609,7 +609,7 @@ class vector
//! <b>Throws</b>: Nothing
//!
//! <b>Complexity</b>: Constant.
explicit vector(const Allocator& a) BOOST_CONTAINER_NOEXCEPT
explicit vector(const A& a) BOOST_CONTAINER_NOEXCEPT
: m_holder(a)
{}
@@ -943,7 +943,7 @@ class vector
if (first == last){
//There are no more elements in the sequence, erase remaining
T* const end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
T* const end_pos = this->back_raw();
const size_type n = static_cast<size_type>(end_pos - container_detail::iterator_to_raw_pointer(cur));
this->priv_destroy_last_n(n);
}
@@ -1435,7 +1435,7 @@ class vector
//
//////////////////////////////////////////////
//! <b>Returns</b>: Allocator pointer such that [data(),data() + size()) is a valid range.
//! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
//! For a non-empty vector, data() == &front().
//!
//! <b>Throws</b>: Nothing.
@@ -1444,7 +1444,7 @@ class vector
T* data() BOOST_CONTAINER_NOEXCEPT
{ return container_detail::to_raw_pointer(this->m_holder.start()); }
//! <b>Returns</b>: Allocator pointer such that [data(),data() + size()) is a valid range.
//! <b>Returns</b>: A pointer such that [data(),data() + size()) is a valid range.
//! For a non-empty vector, data() == &front().
//!
//! <b>Throws</b>: Nothing.
@@ -1459,7 +1459,7 @@ class vector
//
//////////////////////////////////////////////
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the end of the vector.
//!
@@ -1468,21 +1468,41 @@ class vector
//!
//! <b>Complexity</b>: Amortized constant time.
template<class ...Args>
void emplace_back(Args &&...args)
void emplace_back(BOOST_FWD_REF(Args)...args)
{
if (BOOST_LIKELY(this->m_holder.m_size < this->m_holder.capacity())){
T* const back_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
if (BOOST_LIKELY(this->room_enough())){
//There is more memory, just construct a new object at the end
allocator_traits_type::construct(this->m_holder.alloc(), back_pos, ::boost::forward<Args>(args)...);
allocator_traits_type::construct(this->m_holder.alloc(), this->back_raw(), ::boost::forward<Args>(args)...);
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
typedef container_detail::insert_emplace_proxy<A, T*, Args...> type;
this->priv_forward_range_insert_no_capacity
(vector_iterator_get_ptr(this->cend()), 1, type(::boost::forward<Args>(args)...), alloc_version());
(this->back_ptr(), 1, type(::boost::forward<Args>(args)...), alloc_version());
}
}
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the end of the vector.
//!
//! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
//! T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Constant time.
//!
//! <b>Note</b>: Non-standard extension.
template<class ...Args>
bool stable_emplace_back(BOOST_FWD_REF(Args)...args)
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
//There is more memory, just construct a new object at the end
allocator_traits_type::construct(this->m_holder.alloc(), this->back_raw(), ::boost::forward<Args>(args)...);
++this->m_holder.m_size;
}
return is_room_enough;
}
//! <b>Requires</b>: position must be a valid iterator of *this.
//!
//! <b>Effects</b>: Inserts an object of type T constructed with
@@ -1494,49 +1514,237 @@ class vector
//! <b>Complexity</b>: If position is end(), amortized constant time
//! Linear time otherwise.
template<class ...Args>
iterator emplace(const_iterator position, Args && ...args)
iterator emplace(const_iterator position, BOOST_FWD_REF(Args) ...args)
{
//Just call more general insert(pos, size, value) and return iterator
typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
typedef container_detail::insert_emplace_proxy<A, T*, Args...> type;
return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1
, type(::boost::forward<Args>(args)...), alloc_version());
}
#else
#define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
T* const back_pos = container_detail::to_raw_pointer \
(this->m_holder.start()) + this->m_holder.m_size; \
if (BOOST_LIKELY(this->m_holder.m_size < this->m_holder.capacity())){ \
allocator_traits_type::construct (this->m_holder.alloc() \
, back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
++this->m_holder.m_size; \
} \
else{ \
typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
<Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
this->priv_forward_range_insert_no_capacity \
( vector_iterator_get_ptr(this->cend()), 1 \
, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version()); \
} \
} \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace(const_iterator pos \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
<Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
return this->priv_forward_range_insert \
( container_detail::to_raw_pointer(vector_iterator_get_ptr(pos)), 1 \
, type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version()); \
} \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
//0 arg
void emplace_back()
{
if (BOOST_LIKELY(this->room_enough())){
allocator_traits_type::construct (this->m_holder.alloc(), this->back_raw());
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy_arg0<A, T*> type;
this->priv_forward_range_insert_no_capacity
( this->back_ptr(), 1, type(), alloc_version());
}
}
bool stable_emplace_back()
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
allocator_traits_type::construct (this->m_holder.alloc(), this->back_raw());
++this->m_holder.m_size;
}
return is_room_enough;
}
iterator emplace(const_iterator pos)
{
typedef container_detail::insert_emplace_proxy_arg0<A, T*> type;
return this->priv_forward_range_insert
( vector_iterator_get_ptr(pos), 1
, type(), alloc_version());
}
//1 arg
template<class P0>
void emplace_back(BOOST_FWD_REF(P0) p0)
{
if (BOOST_LIKELY(this->room_enough())){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0));
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy_arg1<A, T*, P0> type;
this->priv_forward_range_insert_no_capacity
( this->back_ptr(), 1
, type(::boost::forward<P0>(p0)), alloc_version());
}
}
template<class P0>
bool stable_emplace_back(BOOST_FWD_REF(P0) p0)
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0));
++this->m_holder.m_size;
}
return is_room_enough;
}
template<class P0>
iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0)
{
typedef container_detail::insert_emplace_proxy_arg1<A, T*, P0> type;
return this->priv_forward_range_insert
( vector_iterator_get_ptr(pos), 1
, type(::boost::forward<P0>(p0)), alloc_version());
}
//2 arg
template<class P0, class P1>
void emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1)
{
if (BOOST_LIKELY(this->room_enough())){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1));
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy_arg2<A, T*, P0, P1> type;
this->priv_forward_range_insert_no_capacity
( this->back_ptr(), 1
, type(::boost::forward<P0>(p0),::boost::forward<P1>(p1)), alloc_version());
}
}
template<class P0, class P1>
bool stable_emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1)
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1));
++this->m_holder.m_size;
}
return is_room_enough;
}
template<class P0, class P1>
iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1)
{
typedef container_detail::insert_emplace_proxy_arg2<A, T*, P0, P1> type;
return this->priv_forward_range_insert
( vector_iterator_get_ptr(pos), 1
, type(::boost::forward<P0>(p0), ::boost::forward<P1>(p1)), alloc_version());
}
//3 arg
template<class P0, class P1, class P2>
void emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2)
{
if (BOOST_LIKELY(this->room_enough())){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1), ::boost::forward<P2>(p2));
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy_arg3<A, T*, P0, P1, P2> type;
this->priv_forward_range_insert_no_capacity
( this->back_ptr(), 1
, type(::boost::forward<P0>(p0),::boost::forward<P1>(p1),::boost::forward<P2>(p2)), alloc_version());
}
}
template<class P0, class P1, class P2>
bool stable_emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2)
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1),::boost::forward<P2>(p2));
++this->m_holder.m_size;
}
return is_room_enough;
}
template<class P0, class P1, class P2>
iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2)
{
typedef container_detail::insert_emplace_proxy_arg3<A, T*, P0, P1, P2> type;
return this->priv_forward_range_insert
( vector_iterator_get_ptr(pos), 1
, type(::boost::forward<P0>(p0), ::boost::forward<P1>(p1),::boost::forward<P2>(p2)), alloc_version());
}
//4 arg
template<class P0, class P1, class P2, class P3>
void emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2, BOOST_FWD_REF(P3) p3)
{
if (BOOST_LIKELY(this->room_enough())){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1), ::boost::forward<P2>(p2), ::boost::forward<P3>(p3));
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy_arg4<A, T*, P0, P1, P2, P3> type;
this->priv_forward_range_insert_no_capacity
( this->back_ptr(), 1
, type(::boost::forward<P0>(p0),::boost::forward<P1>(p1),::boost::forward<P2>(p2),::boost::forward<P3>(p3)), alloc_version());
}
}
template<class P0, class P1, class P2, class P3>
bool stable_emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2, BOOST_FWD_REF(P3) p3)
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1), ::boost::forward<P2>(p2), ::boost::forward<P3>(p3));
++this->m_holder.m_size;
}
return is_room_enough;
}
template<class P0, class P1, class P2, class P3>
iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2, BOOST_FWD_REF(P3) p3)
{
typedef container_detail::insert_emplace_proxy_arg4<A, T*, P0, P1, P2, P3> type;
return this->priv_forward_range_insert
( vector_iterator_get_ptr(pos), 1
, type(::boost::forward<P0>(p0), ::boost::forward<P1>(p1),::boost::forward<P2>(p2),::boost::forward<P3>(p3)), alloc_version());
}
//5 arg
template<class P0, class P1, class P2, class P3, class P4>
void emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2, BOOST_FWD_REF(P3) p3, BOOST_FWD_REF(P4) p4)
{
if (BOOST_LIKELY(this->room_enough())){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1), ::boost::forward<P2>(p2), ::boost::forward<P3>(p3), ::boost::forward<P4>(p4));
++this->m_holder.m_size;
}
else{
typedef container_detail::insert_emplace_proxy_arg5<A, T*, P0, P1, P2, P3, P4> type;
this->priv_forward_range_insert_no_capacity
( this->back_ptr(), 1
, type(::boost::forward<P0>(p0),::boost::forward<P1>(p1),::boost::forward<P2>(p2),::boost::forward<P3>(p3),::boost::forward<P4>(p4)), alloc_version());
}
}
template<class P0, class P1, class P2, class P3, class P4>
bool stable_emplace_back(BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2, BOOST_FWD_REF(P3) p3, BOOST_FWD_REF(P4) p4)
{
const bool is_room_enough = this->room_enough();
if (BOOST_LIKELY(is_room_enough)){
allocator_traits_type::construct (this->m_holder.alloc()
, this->back_raw(), ::boost::forward<P0>(p0), ::boost::forward<P1>(p1), ::boost::forward<P2>(p2), ::boost::forward<P3>(p3));
++this->m_holder.m_size;
}
return is_room_enough;
}
template<class P0, class P1, class P2, class P3, class P4>
iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1, BOOST_FWD_REF(P2) p2, BOOST_FWD_REF(P3) p3, BOOST_FWD_REF(P4) p4)
{
typedef container_detail::insert_emplace_proxy_arg5<A, T*, P0, P1, P2, P3, P4> type;
return this->priv_forward_range_insert
( vector_iterator_get_ptr(pos), 1
, type(::boost::forward<P0>(p0),::boost::forward<P1>(p1),::boost::forward<P2>(p2),::boost::forward<P3>(p3),::boost::forward<P4>(p4)), alloc_version());
}
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -1596,7 +1804,7 @@ class vector
//! <b>Complexity</b>: Linear to n.
iterator insert(const_iterator p, size_type n, const T& x)
{
container_detail::insert_n_copies_proxy<Allocator, T*> proxy(x);
container_detail::insert_n_copies_proxy<A, T*> proxy(x);
return this->priv_forward_range_insert(vector_iterator_get_ptr(p), n, proxy, alloc_version());
}
@@ -1636,7 +1844,7 @@ class vector
>::type * = 0
)
{
container_detail::insert_range_proxy<Allocator, FwdIt, T*> proxy(first);
container_detail::insert_range_proxy<A, FwdIt, T*> proxy(first);
return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), boost::container::iterator_distance(first, last), proxy, alloc_version());
}
#endif
@@ -1663,7 +1871,7 @@ class vector
BOOST_ASSERT(container_detail::is_input_iterator<InIt>::value ||
num == static_cast<size_type>(boost::container::iterator_distance(first, last)));
(void)last;
container_detail::insert_range_proxy<Allocator, InIt, T*> proxy(first);
container_detail::insert_range_proxy<A, InIt, T*> proxy(first);
return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy, alloc_version());
}
#endif
@@ -1719,7 +1927,7 @@ class vector
iterator erase(const_iterator first, const_iterator last)
{
if (first != last){
T* const old_end_ptr = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
T* const old_end_ptr = this->back_raw();
T* const first_ptr = container_detail::to_raw_pointer(vector_iterator_get_ptr(first));
T* const last_ptr = container_detail::to_raw_pointer(vector_iterator_get_ptr(last));
T* const ptr = container_detail::to_raw_pointer(boost::move(last_ptr, old_end_ptr, first_ptr));
@@ -1733,7 +1941,7 @@ class vector
//! <b>Throws</b>: Nothing.
//!
//! <b>Complexity</b>: Constant.
void swap(vector& x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail::is_version<Allocator, 0>::value))
void swap(vector& x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail::is_version<A, 0>::value))
{
//Just swap internals in case of !allocator_v0. Otherwise, deep swap
this->m_holder.swap(x.m_holder);
@@ -1831,8 +2039,8 @@ class vector
//! <b>Note</b>: Non-standard extension.
bool stable_reserve(size_type new_cap)
{
const bool room_enough = this->capacity() < new_cap;
if(!room_enough && alloc_version::value < 2){
const bool is_room_enough = this->capacity() < new_cap;
if(!is_room_enough && alloc_version::value < 2){
return false;
}
else{
@@ -1914,51 +2122,17 @@ class vector
}
}
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... in the end of the vector.
//!
//! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
//! T's copy/move constructor throws.
//!
//! <b>Complexity</b>: Amortized constant time.
template<class ...Args>
bool stable_emplace_back(Args &&...args)
{
const bool room_enough = this->m_holder.m_size < this->m_holder.capacity();
if (BOOST_LIKELY(room_enough)){
T* const back_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
//There is more memory, just construct a new object at the end
allocator_traits_type::construct(this->m_holder.alloc(), back_pos, ::boost::forward<Args>(args)...);
++this->m_holder.m_size;
}
return room_enough;
}
#else
#define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
bool stable_emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ \
const bool room_enough = this->m_holder.m_size < this->m_holder.capacity(); \
if (BOOST_LIKELY(room_enough)){ \
T* const back_pos = container_detail::to_raw_pointer \
(this->m_holder.start()) + this->m_holder.m_size; \
allocator_traits_type::construct (this->m_holder.alloc() \
, back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
++this->m_holder.m_size; \
} \
return room_enough; \
} \
//!
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
private:
bool room_enough() const
{ return this->m_holder.m_size < this->m_holder.capacity(); }
pointer back_ptr() const
{ return this->m_holder.start() + this->m_holder.m_size; }
T* back_raw() const
{ return container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size; }
size_type priv_index_of(pointer p) const
{
BOOST_ASSERT(this->m_holder.start() <= p);
@@ -2053,9 +2227,9 @@ class vector
void priv_reserve(size_type, allocator_v0)
{ throw_bad_alloc(); }
container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*> priv_dummy_empty_proxy()
container_detail::insert_range_proxy<A, boost::move_iterator<T*>, T*> priv_dummy_empty_proxy()
{
return container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*>
return container_detail::insert_range_proxy<A, boost::move_iterator<T*>, T*>
(::boost::make_move_iterator((T *)0));
}
@@ -2066,7 +2240,7 @@ class vector
//We will reuse insert code, so create a dummy input iterator
this->priv_forward_range_insert_new_allocation
( container_detail::to_raw_pointer(p), new_cap
, container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size
, this->back_raw()
, 0, this->priv_dummy_empty_proxy());
}
@@ -2089,7 +2263,7 @@ class vector
}
else{ //If there is no forward expansion, move objects, we will reuse insertion code
T * const new_mem = container_detail::to_raw_pointer(ret.first);
T * const ins_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
T * const ins_pos = this->back_raw();
if(ret.second){ //Backwards (and possibly forward) expansion
#ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
++this->num_expand_bwd;
@@ -2110,7 +2284,7 @@ class vector
void priv_destroy_last() BOOST_CONTAINER_NOEXCEPT
{
if(!value_traits::trivial_dctr){
value_type* const p = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size - 1;
value_type* const p = this->back_raw() - 1;
allocator_traits_type::destroy(this->get_stored_allocator(), p);
}
--this->m_holder.m_size;
@@ -2120,7 +2294,7 @@ class vector
{
(void)moved;
if(!(value_traits::trivial_dctr || (value_traits::trivial_dctr_after_move && moved))){
value_type* const p = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size - 1;
value_type* const p = this->back_raw() - 1;
allocator_traits_type::destroy(this->get_stored_allocator(), p);
}
--this->m_holder.m_size;
@@ -2150,7 +2324,7 @@ class vector
template<class InpIt>
void priv_uninitialized_construct_at_end(InpIt first, InpIt last)
{
T* const old_end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
T* const old_end_pos = this->back_raw();
T* const new_end_pos = boost::container::uninitialized_copy_alloc(this->m_holder.alloc(), first, last, old_end_pos);
this->m_holder.m_size += new_end_pos - old_end_pos;
}
@@ -2166,20 +2340,20 @@ class vector
iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x)
{
return this->priv_forward_range_insert
( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy<T*, Allocator>
( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy<T*, A>
(::boost::forward<U>(x)), alloc_version());
}
container_detail::insert_copy_proxy<Allocator, T*> priv_single_insert_proxy(const T &x)
{ return container_detail::insert_copy_proxy<Allocator, T*> (x); }
container_detail::insert_copy_proxy<A, T*> priv_single_insert_proxy(const T &x)
{ return container_detail::insert_copy_proxy<A, T*> (x); }
container_detail::insert_move_proxy<Allocator, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x)
{ return container_detail::insert_move_proxy<Allocator, T*> (x); }
container_detail::insert_move_proxy<A, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x)
{ return container_detail::insert_move_proxy<A, T*> (x); }
template <class U>
void priv_push_back(BOOST_FWD_REF(U) u)
{
if (BOOST_LIKELY(this->m_holder.m_size < this->m_holder.capacity())){
if (BOOST_LIKELY(this->room_enough())){
//There is more memory, just construct a new object at the end
allocator_traits_type::construct
( this->m_holder.alloc()
@@ -2189,19 +2363,19 @@ class vector
}
else{
this->priv_forward_range_insert_no_capacity
( vector_iterator_get_ptr(this->cend()), 1
( this->back_ptr(), 1
, this->priv_single_insert_proxy(::boost::forward<U>(u)), alloc_version());
}
}
container_detail::insert_n_copies_proxy<Allocator, T*> priv_resize_proxy(const T &x)
{ return container_detail::insert_n_copies_proxy<Allocator, T*>(x); }
container_detail::insert_n_copies_proxy<A, T*> priv_resize_proxy(const T &x)
{ return container_detail::insert_n_copies_proxy<A, T*>(x); }
container_detail::insert_default_initialized_n_proxy<Allocator, T*> priv_resize_proxy(default_init_t)
{ return container_detail::insert_default_initialized_n_proxy<Allocator, T*>(); }
container_detail::insert_default_initialized_n_proxy<A, T*> priv_resize_proxy(default_init_t)
{ return container_detail::insert_default_initialized_n_proxy<A, T*>(); }
container_detail::insert_value_initialized_n_proxy<Allocator, T*> priv_resize_proxy(value_init_t)
{ return container_detail::insert_value_initialized_n_proxy<Allocator, T*>(); }
container_detail::insert_value_initialized_n_proxy<A, T*> priv_resize_proxy(value_init_t)
{ return container_detail::insert_value_initialized_n_proxy<A, T*>(); }
template <class U>
void priv_resize(size_type new_size, const U& u)
@@ -2420,14 +2594,14 @@ class vector
iterator priv_forward_range_insert_at_end
(const size_type n, const InsertionProxy insert_range_proxy, allocator_v1)
{
return this->priv_forward_range_insert(vector_iterator_get_ptr(this->cend()), n, insert_range_proxy, allocator_v1());
return this->priv_forward_range_insert(this->back_ptr(), n, insert_range_proxy, allocator_v1());
}
template <class InsertionProxy>
iterator priv_forward_range_insert_at_end
(const size_type n, const InsertionProxy insert_range_proxy, allocator_v2)
{
return this->priv_forward_range_insert(vector_iterator_get_ptr(this->cend()), n, insert_range_proxy, allocator_v2());
return this->priv_forward_range_insert(this->back_ptr(), n, insert_range_proxy, allocator_v2());
}
//Absolutely experimental. This function might change, disappear or simply crash!
@@ -2511,7 +2685,7 @@ class vector
//| prefix | range | suffix |raw_mem ~
//|____________|_______|__________________|_____________~
//
//New situation in Case Allocator (hole_size == 0):
//New situation in Case A (hole_size == 0):
// range is moved through move assignments
//
// first_pos last_pos limit_pos
@@ -2583,7 +2757,7 @@ class vector
template <class InsertionProxy>
void priv_forward_range_insert_at_end_expand_forward(const size_type n, InsertionProxy insert_range_proxy)
{
T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
T* const old_finish = this->back_raw();
insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
this->m_holder.m_size += n;
}
@@ -2594,7 +2768,7 @@ class vector
//n can't be 0, because there is nothing to do in that case
if(!n) return;
//There is enough memory
T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
T* const old_finish = this->back_raw();
const size_type elems_after = old_finish - pos;
if (!elems_after){
@@ -3021,9 +3195,9 @@ namespace boost {
/*
//!has_trivial_destructor_after_move<> == true_type
//!specialization for optimizations
template <class T, class Allocator>
struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator> >
: public ::boost::has_trivial_destructor_after_move<Allocator>
template <class T, class A>
struct has_trivial_destructor_after_move<boost::container::vector<T, A> >
: public ::boost::has_trivial_destructor_after_move<A>
{};
*/
}
@@ -3034,8 +3208,8 @@ struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator>
namespace std {
template <class T, class Allocator>
inline void swap(boost::container::vector<T, Allocator>& x, boost::container::vector<T, Allocator>& y)
template <class T, class A>
inline void swap(boost::container::vector<T, A>& x, boost::container::vector<T, A>& y)
{ x.swap(y); }
} //namespace std {