From 955248b73921f2dd134ab5b90663304ac50e3a27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Thu, 11 Dec 2014 22:01:58 +0100 Subject: [PATCH] Replace "Allocator" template parameter with "A", according to the standard. --- bench/bench_adaptive_node_pool.cpp | 10 +- bench/bench_alloc_expand_bwd.cpp | 12 +- bench/bench_alloc_expand_fwd.cpp | 12 +- bench/bench_alloc_shrink_to_fit.cpp | 12 +- ...h_alloc_stable_vector_burst_allocation.cpp | 22 +- bench/detail/varray.hpp | 18 +- bench/detail/varray_concept.hpp | 4 +- include/boost/container/container_fwd.hpp | 28 +- include/boost/container/deque.hpp | 70 +-- .../detail/allocator_version_traits.hpp | 42 +- include/boost/container/detail/destroyers.hpp | 54 +- include/boost/container/detail/hash_table.hpp | 12 +- include/boost/container/flat_map.hpp | 198 +++---- include/boost/container/flat_set.hpp | 72 +-- include/boost/container/list.hpp | 48 +- include/boost/container/map.hpp | 174 +++--- include/boost/container/scoped_allocator.hpp | 34 +- .../boost/container/scoped_allocator_fwd.hpp | 2 +- include/boost/container/set.hpp | 72 +-- include/boost/container/slist.hpp | 48 +- include/boost/container/stable_vector.hpp | 34 +- include/boost/container/string.hpp | 254 ++++----- include/boost/container/vector.hpp | 534 ++++++++++++------ 23 files changed, 970 insertions(+), 796 deletions(-) diff --git a/bench/bench_adaptive_node_pool.cpp b/bench/bench_adaptive_node_pool.cpp index 2085c07..4e4bb3f 100644 --- a/bench/bench_adaptive_node_pool.cpp +++ b/bench/bench_adaptive_node_pool.cpp @@ -79,7 +79,7 @@ template class bc::node_allocator , bc::NodeAlloc_nodes_per_block , 2>; -template struct get_allocator_name; +template struct get_allocator_name; template<> struct get_allocator_name { static const char *get() { return "StdAllocator"; } }; @@ -124,10 +124,10 @@ class MyInt } }; -template +template void list_test_template(std::size_t num_iterations, std::size_t num_elements, bool csv_output) { - typedef typename Allocator::template rebind::other IntAllocator; + typedef typename A::template rebind::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::get() + std::cout << get_allocator_name::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::get() + << "A: " << get_allocator_name::get() << std::endl << " allocation/deallocation(ns): " << float(tinsert)/(num_iterations*num_elements) << '\t' << float(terase)/(num_iterations*num_elements) << std::endl diff --git a/bench/bench_alloc_expand_bwd.cpp b/bench/bench_alloc_expand_bwd.cpp index b598ede..8b0c468 100644 --- a/bench/bench_alloc_expand_bwd.cpp +++ b/bench/bench_alloc_expand_bwd.cpp @@ -32,7 +32,7 @@ typedef bc::allocator AllocatorPlusV2Ma typedef bc::allocator AllocatorPlusV2; typedef bc::allocator AllocatorPlusV1; -template struct get_allocator_name; +template struct get_allocator_name; template<> struct get_allocator_name { static const char *get() { return "StdAllocator"; } }; @@ -90,14 +90,14 @@ struct has_trivial_destructor_after_move 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 +template void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output) { - typedef typename Allocator::template rebind::other IntAllocator; + typedef typename A::template rebind::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::get() + std::cout << get_allocator_name::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::get() + << "A: " << get_allocator_name::get() << std::endl << " push_back ns: " << float(nseconds)/(num_iterations*num_elements) diff --git a/bench/bench_alloc_expand_fwd.cpp b/bench/bench_alloc_expand_fwd.cpp index 1f88da4..d25a771 100644 --- a/bench/bench_alloc_expand_fwd.cpp +++ b/bench/bench_alloc_expand_fwd.cpp @@ -35,7 +35,7 @@ typedef bc::allocator AllocatorPlusV2Ma typedef bc::allocator AllocatorPlusV2; typedef bc::allocator AllocatorPlusV1; -template struct get_allocator_name; +template struct get_allocator_name; template<> struct get_allocator_name { static const char *get() { return "StdAllocator"; } }; @@ -124,10 +124,10 @@ class MyInt } }; -template class Vector> +template class Vector> void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output) { - typedef typename Allocator::template rebind::other IntAllocator; + typedef typename A::template rebind::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::get() + std::cout << get_allocator_name::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::get() + << "A: " << get_allocator_name::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; } diff --git a/bench/bench_alloc_shrink_to_fit.cpp b/bench/bench_alloc_shrink_to_fit.cpp index d8a9404..61975d5 100644 --- a/bench/bench_alloc_shrink_to_fit.cpp +++ b/bench/bench_alloc_shrink_to_fit.cpp @@ -34,7 +34,7 @@ typedef std::allocator StdAllocator; typedef bc::allocator AllocatorPlusV2; typedef bc::allocator AllocatorPlusV1; -template struct get_allocator_name; +template struct get_allocator_name; template<> struct get_allocator_name { static const char *get() { return "StdAllocator"; } }; @@ -69,10 +69,10 @@ void print_header() << "num_shrink" << ";" << "shrink_to_fit(ns)" << std::endl; } -template +template void vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output) { - typedef typename Allocator::template rebind::other IntAllocator; + typedef typename A::template rebind::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 - ::value> alloc_version; + ::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::get() + std::cout << get_allocator_name::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::get() + << "A: " << get_allocator_name::get() << std::endl << " num_shrink: " << num_shrink << std::endl diff --git a/bench/bench_alloc_stable_vector_burst_allocation.cpp b/bench/bench_alloc_stable_vector_burst_allocation.cpp index cbbde70..2b18f6a 100644 --- a/bench/bench_alloc_stable_vector_burst_allocation.cpp +++ b/bench/bench_alloc_stable_vector_burst_allocation.cpp @@ -41,7 +41,7 @@ typedef bc::adaptive_pool , 2 , 2> AdPool2PercentV2; -template struct get_allocator_name; +template struct get_allocator_name; template<> struct get_allocator_name { static const char *get() { return "StdAllocator"; } }; @@ -71,32 +71,32 @@ class MyInt } }; -template +template struct get_vector { typedef bc::vector - ::other> type; + ::other> type; static const char *vector_name() { return "vector"; } }; -template +template struct get_stable_vector { typedef bc::stable_vector - ::other> type; + ::other> type; static const char *vector_name() { return "stable_vector"; } }; -template class GetContainer, class Allocator> +template class GetContainer, class A> void stable_vector_test_template(unsigned int num_iterations, unsigned int num_elements, bool csv_output) { - typedef typename GetContainer::type vector_type; + typedef typename GetContainer::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::get() + std::cout << get_allocator_name::get() << ";" - << GetContainer::vector_name() + << GetContainer::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::get() + std::cout << "Allocator: " << get_allocator_name::get() << '\t' - << GetContainer::vector_name() + << GetContainer::vector_name() << std::endl << " allocation ns: " << float(nseconds)/(num_iterations*num_elements); diff --git a/bench/detail/varray.hpp b/bench/detail/varray.hpp index 6629ad3..f45765c 100644 --- a/bench/detail/varray.hpp +++ b/bench/detail/varray.hpp @@ -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 +//! @tparam A The Allocator which will be adapted. +template 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() { diff --git a/bench/detail/varray_concept.hpp b/bench/detail/varray_concept.hpp index 103c60b..6f044a9 100644 --- a/bench/detail/varray_concept.hpp +++ b/bench/detail/varray_concept.hpp @@ -17,14 +17,14 @@ namespace boost { namespace container { namespace container_detail { namespace c /** * VArrayStrategyConcept * - * \brief Checks strategy for varray, which has similarities to std::Allocator + * \brief Checks strategy for varray, which has similarities to std::allocator * \ingroup varray */ template 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; diff --git a/include/boost/container/container_fwd.hpp b/include/boost/container/container_fwd.hpp index 20ac778..ee3ba1b 100644 --- a/include/boost/container/container_fwd.hpp +++ b/include/boost/container/container_fwd.hpp @@ -81,26 +81,26 @@ enum tree_type_enum #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED template > + ,class A = std::allocator > class vector; template > + ,class A = std::allocator > class stable_vector; template class static_vector; template > + ,class A = std::allocator > class deque; template > + ,class A = std::allocator > class list; template > + ,class A = std::allocator > class slist; template @@ -110,55 +110,55 @@ typedef tree_opt tree_assoc_defaults; template - ,class Allocator = std::allocator + ,class A = std::allocator ,class Options = tree_assoc_defaults > class set; template - ,class Allocator = std::allocator + ,class A = std::allocator ,class Options = tree_assoc_defaults > class multiset; template - ,class Allocator = std::allocator > + ,class A = std::allocator > ,class Options = tree_assoc_defaults > class map; template - ,class Allocator = std::allocator > + ,class A = std::allocator > ,class Options = tree_assoc_defaults > class multimap; template - ,class Allocator = std::allocator > + ,class A = std::allocator > class flat_set; template - ,class Allocator = std::allocator > + ,class A = std::allocator > class flat_multiset; template - ,class Allocator = std::allocator > > + ,class A = std::allocator > > class flat_map; template - ,class Allocator = std::allocator > > + ,class A = std::allocator > > class flat_multimap; template - ,class Allocator = std::allocator > + ,class A = std::allocator > class basic_string; typedef basic_string diff --git a/include/boost/container/deque.hpp b/include/boost/container/deque.hpp index 1e8d9b1..69c4830 100644 --- a/include/boost/container/deque.hpp +++ b/include/boost/container/deque.hpp @@ -54,7 +54,7 @@ namespace boost { namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -template +template class deque; template @@ -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 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 +template class deque_base { BOOST_COPYABLE_AND_MOVABLE(deque_base) public: - typedef allocator_traits val_alloc_traits_type; + typedef allocator_traits 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 > +//! \tparam A The allocator used for all internal memory management +template > #else -template +template #endif -class deque : protected deque_base +class deque : protected deque_base { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: - typedef deque_base Base; + typedef deque_base Base; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -497,13 +497,13 @@ class deque : protected deque_base ////////////////////////////////////////////// typedef T value_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 typedef typename Base::ptr_alloc_ptr index_pointer; static size_type s_buffer_size() { return Base::s_buffer_size(); } - typedef allocator_traits allocator_traits_type; + typedef allocator_traits allocator_traits_type; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -556,7 +556,7 @@ class deque : protected deque_base explicit deque(size_type n) : Base(n, allocator_type()) { - container_detail::insert_value_initialized_n_proxy proxy; + container_detail::insert_value_initialized_n_proxy 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 deque(size_type n, default_init_t) : Base(n, allocator_type()) { - container_detail::insert_default_initialized_n_proxy proxy; + container_detail::insert_default_initialized_n_proxy 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 this->priv_erase_last_n(len - new_size); else{ const size_type n = new_size - this->size(); - container_detail::insert_value_initialized_n_proxy proxy; + container_detail::insert_value_initialized_n_proxy proxy; priv_insert_back_aux_impl(n, proxy); } } @@ -1051,7 +1051,7 @@ class deque : protected deque_base this->priv_erase_last_n(len - new_size); else{ const size_type n = new_size - this->size(); - container_detail::insert_default_initialized_n_proxy proxy; + container_detail::insert_default_initialized_n_proxy proxy; priv_insert_back_aux_impl(n, proxy); } } @@ -1268,7 +1268,7 @@ class deque : protected deque_base this->priv_push_front_simple_commit(); } else{ - typedef container_detail::insert_non_movable_emplace_proxy type; + typedef container_detail::insert_non_movable_emplace_proxy type; this->priv_insert_front_aux_impl(1, type(boost::forward(args)...)); } } @@ -1290,7 +1290,7 @@ class deque : protected deque_base this->priv_push_back_simple_commit(); } else{ - typedef container_detail::insert_non_movable_emplace_proxy type; + typedef container_detail::insert_non_movable_emplace_proxy type; this->priv_insert_back_aux_impl(1, type(boost::forward(args)...)); } } @@ -1316,7 +1316,7 @@ class deque : protected deque_base return (this->end()-1); } else{ - typedef container_detail::insert_emplace_proxy type; + typedef container_detail::insert_emplace_proxy type; return this->priv_insert_aux_impl(p, 1, type(boost::forward(args)...)); } } @@ -1337,7 +1337,7 @@ class deque : protected deque_base } \ else{ \ typedef container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \ - type; \ + 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 } \ else{ \ typedef container_detail::BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, n) \ - type; \ + 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 } \ else{ \ typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \ - type; \ + 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 #endif ) { - container_detail::insert_range_proxy proxy(first); + container_detail::insert_range_proxy 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 else { return priv_insert_aux_impl ( p, (size_type)1 - , container_detail::get_insert_value_proxy(::boost::forward(x))); + , container_detail::get_insert_value_proxy(::boost::forward(x))); } } @@ -1764,7 +1764,7 @@ class deque : protected deque_base else{ priv_insert_aux_impl ( this->cbegin(), (size_type)1 - , container_detail::get_insert_value_proxy(::boost::forward(x))); + , container_detail::get_insert_value_proxy(::boost::forward(x))); } } @@ -1779,7 +1779,7 @@ class deque : protected deque_base else{ priv_insert_aux_impl ( this->cend(), (size_type)1 - , container_detail::get_insert_value_proxy(::boost::forward(x))); + , container_detail::get_insert_value_proxy(::boost::forward(x))); } } @@ -2125,9 +2125,9 @@ namespace boost { //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > - : public ::boost::has_trivial_destructor_after_move +template +struct has_trivial_destructor_after_move > + : public ::boost::has_trivial_destructor_after_move {}; } diff --git a/include/boost/container/detail/allocator_version_traits.hpp b/include/boost/container/detail/allocator_version_traits.hpp index 18bb2ac..b4733da 100644 --- a/include/boost/container/detail/allocator_version_traits.hpp +++ b/include/boost/container/detail/allocator_version_traits.hpp @@ -32,32 +32,32 @@ namespace boost { namespace container { namespace container_detail { -template::value> +template::value> struct allocator_version_traits { typedef ::boost::container::container_detail::integral_constant alloc_version; - typedef typename Allocator::multiallocation_chain multiallocation_chain; + typedef typename A::multiallocation_chain multiallocation_chain; - typedef typename boost::container::allocator_traits::pointer pointer; - typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::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 - 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 -struct allocator_version_traits +template +struct allocator_version_traits { typedef ::boost::container::container_detail::integral_constant alloc_version; - typedef typename boost::container::allocator_traits::pointer pointer; - typedef typename boost::container::allocator_traits::size_type size_type; - typedef typename boost::container::allocator_traits::value_type value_type; + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::value_type value_type; typedef typename boost::intrusive::pointer_traits:: template rebind_pointer::type void_ptr; @@ -85,13 +85,13 @@ struct allocator_version_traits < 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 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 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 } static std::pair - 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 &) { diff --git a/include/boost/container/detail/destroyers.hpp b/include/boost/container/detail/destroyers.hpp index ea9b617..96a61ef 100644 --- a/include/boost/container/detail/destroyers.hpp +++ b/include/boost/container/detail/destroyers.hpp @@ -76,14 +76,14 @@ struct scoped_deallocator { m_ptr = 0; } }; -template +template struct null_scoped_deallocator { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits 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 +template struct scoped_array_deallocator { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits 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 +template struct null_scoped_array_deallocator { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits 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 +template struct scoped_destroy_deallocator { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits AllocTraits; typedef typename AllocTraits::pointer pointer; typedef typename AllocTraits::size_type size_type; typedef container_detail::integral_constant::value> alloc_version; + version::value> alloc_version; typedef container_detail::integral_constant allocator_v1; typedef container_detail::integral_constant 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 +template struct scoped_destructor_n { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits 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 +template struct null_scoped_destructor_n { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits 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 +template class allocator_destroyer { - typedef boost::container::allocator_traits AllocTraits; + typedef boost::container::allocator_traits AllocTraits; typedef typename AllocTraits::value_type value_type; typedef typename AllocTraits::pointer pointer; typedef container_detail::integral_constant::value> alloc_version; + version::value> alloc_version; typedef container_detail::integral_constant allocator_v1; typedef container_detail::integral_constant 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) {} diff --git a/include/boost/container/detail/hash_table.hpp b/include/boost/container/detail/hash_table.hpp index da7bb53..0fad5a4 100644 --- a/include/boost/container/detail/hash_table.hpp +++ b/include/boost/container/detail/hash_table.hpp @@ -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::value && is_nothrow_move_constructible::value && is_nothrow_move_constructible::value); - hash_set(hash_set&&, const Allocator&); + hash_set(hash_set&&, const A&); hash_set(initializer_list, 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::value && is_nothrow_move_constructible::value && is_nothrow_move_constructible::value); - hash_map(hash_map&&, const Allocator&); + hash_map(hash_map&&, const A&); hash_map(initializer_list, 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::value && is_nothrow_move_constructible::value && is_nothrow_move_constructible::value); - hash_set(hash_set&&, const Allocator&); + hash_set(hash_set&&, const A&); hash_set(initializer_list, size_type n = 0, const hasher& hf = hasher(), const key_equal& eql = key_equal(), const allocator_type& a = allocator_type()); diff --git a/include/boost/container/flat_map.hpp b/include/boost/container/flat_map.hpp index a08e8a3..47ed3e2 100644 --- a/include/boost/container/flat_map.hpp +++ b/include/boost/container/flat_map.hpp @@ -72,7 +72,7 @@ static D force_copy(S s) //! //! Compare is the ordering function for Keys (e.g. std::less). //! -//! Allocator is the allocator to allocate the value_types +//! A is the allocator to allocate the value_types //! (e.g. allocator< std::pair >). //! //! 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 mapped_type //! \tparam Compare is the ordering function for Keys (e.g. std::less). -//! \tparam Allocator is the allocator to allocate the value_types +//! \tparam A is the allocator to allocate the value_types //! (e.g. allocator< std::pair > ). #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template , class Allocator = std::allocator< std::pair< Key, T> > > +template , class A = std::allocator< std::pair< Key, T> > > #else -template +template #endif class flat_map { @@ -104,14 +104,14 @@ class flat_map std::pair, container_detail::select1st< std::pair >, 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, container_detail::select1st >, Compare, - typename allocator_traits::template portable_rebind_alloc + typename allocator_traits::template portable_rebind_alloc >::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 > , std::pair > value_compare_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::iterator iterator_impl; + ::pointer>::iterator iterator_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::const_iterator const_iterator_impl; + ::pointer>::const_iterator const_iterator_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::reverse_iterator reverse_iterator_impl; + ::pointer>::reverse_iterator reverse_iterator_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::const_reverse_iterator const_reverse_iterator_impl; + ::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 value_type; - typedef ::boost::container::allocator_traits allocator_traits_type; - typedef typename boost::container::allocator_traits::pointer pointer; - typedef typename boost::container::allocator_traits::const_pointer const_pointer; - typedef typename boost::container::allocator_traits::reference reference; - typedef typename boost::container::allocator_traits::const_reference const_reference; - typedef typename boost::container::allocator_traits::size_type size_type; - typedef typename boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; - typedef BOOST_CONTAINER_IMPDEF(Allocator) stored_allocator_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::const_pointer const_pointer; + typedef typename boost::container::allocator_traits::reference reference; + typedef typename boost::container::allocator_traits::const_reference const_reference; + typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::difference_type difference_type; + typedef 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: Makes *this a copy of x. @@ -337,7 +337,7 @@ class flat_map } #endif - //! Effects: Returns a copy of the Allocator that + //! Effects: Returns a copy of the allocator that //! was passed to the object's constructor. //! //! Complexity: 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(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(m_flat_tree.find(x)); } - //! Returns: Allocator const_iterator pointing to an element with the key + //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic.s @@ -932,7 +932,7 @@ class flat_map iterator lower_bound(const key_type& x) { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic @@ -946,7 +946,7 @@ class flat_map iterator upper_bound(const key_type& x) { return container_detail::force_copy(m_flat_tree.upper_bound(x)); } - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic @@ -1039,10 +1039,10 @@ class flat_map //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; }; namespace container { @@ -1061,7 +1061,7 @@ namespace container { //! //! Compare is the ordering function for Keys (e.g. std::less). //! -//! Allocator is the allocator to allocate the value_types +//! A is the allocator to allocate the value_types //! (e.g. allocator< std::pair >). //! //! 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 mapped_type //! \tparam Compare is the ordering function for Keys (e.g. std::less). -//! \tparam Allocator is the allocator to allocate the value_types +//! \tparam A is the allocator to allocate the value_types //! (e.g. allocator< std::pair > ). #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template , class Allocator = std::allocator< std::pair< Key, T> > > +template , class A = std::allocator< std::pair< Key, T> > > #else -template +template #endif class flat_multimap { @@ -1092,13 +1092,13 @@ class flat_multimap std::pair, container_detail::select1st< std::pair >, 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, container_detail::select1st >, Compare, - typename allocator_traits::template portable_rebind_alloc + typename allocator_traits::template portable_rebind_alloc >::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 > , std::pair > value_compare_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::iterator iterator_impl; + ::pointer>::iterator iterator_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::const_iterator const_iterator_impl; + ::pointer>::const_iterator const_iterator_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::reverse_iterator reverse_iterator_impl; + ::pointer>::reverse_iterator reverse_iterator_impl; typedef typename container_detail::get_flat_tree_iterators - ::pointer>::const_reverse_iterator const_reverse_iterator_impl; + ::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 value_type; - typedef ::boost::container::allocator_traits allocator_traits_type; - typedef typename boost::container::allocator_traits::pointer pointer; - typedef typename boost::container::allocator_traits::const_pointer const_pointer; - typedef typename boost::container::allocator_traits::reference reference; - typedef typename boost::container::allocator_traits::const_reference const_reference; - typedef typename boost::container::allocator_traits::size_type size_type; - typedef typename boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; - typedef BOOST_CONTAINER_IMPDEF(Allocator) stored_allocator_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::const_pointer const_pointer; + typedef typename boost::container::allocator_traits::reference reference; + typedef typename boost::container::allocator_traits::const_reference const_reference; + typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::difference_type difference_type; + typedef 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, 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 il, const Compare& comp = Compare(), const allocator_type& a = allocator_type()) : m_flat_tree(false, il.begin(), il.end(), comp, container_detail::force(a)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: Makes *this a copy of x. @@ -1318,7 +1318,7 @@ class flat_multimap } #endif - //! Effects: Returns a copy of the Allocator that + //! Effects: Returns a copy of the allocator that //! was passed to the object's constructor. //! //! Complexity: Constant. @@ -1833,7 +1833,7 @@ class flat_multimap iterator lower_bound(const key_type& x) { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } - //! Returns: Allocator const iterator pointing to the first element with key + //! Returns: A const iterator pointing to the first element with key //! not less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic @@ -1847,7 +1847,7 @@ class flat_multimap iterator upper_bound(const key_type& x) {return container_detail::force_copy(m_flat_tree.upper_bound(x)); } - //! Returns: Allocator const iterator pointing to the first element with key + //! Returns: A const iterator pointing to the first element with key //! not less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic @@ -1917,10 +1917,10 @@ namespace boost { //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move< boost::container::flat_multimap > +template +struct has_trivial_destructor_after_move< boost::container::flat_multimap > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; }; } //namespace boost { diff --git a/include/boost/container/flat_set.hpp b/include/boost/container/flat_set.hpp index ab8f56a..0e46cb9 100644 --- a/include/boost/container/flat_set.hpp +++ b/include/boost/container/flat_set.hpp @@ -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 Allocator = std::allocator > +template , class A = std::allocator > #else -template +template #endif class flat_set ///@cond - : public container_detail::flat_tree, Compare, Allocator> + : public container_detail::flat_tree, Compare, A> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_set) - typedef container_detail::flat_tree, Compare, Allocator> base_t; + typedef container_detail::flat_tree, 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_traits_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 - //! Effects: Returns a copy of the Allocator that + //! Effects: Returns a copy of the allocator that //! was passed to the object's constructor. //! //! Complexity: Constant. @@ -641,7 +641,7 @@ class flat_set //! Complexity: Logarithmic. iterator find(const key_type& x); - //! Returns: Allocator const_iterator pointing to an element with the key + //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. @@ -713,7 +713,7 @@ class flat_set //! Complexity: Logarithmic iterator lower_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic @@ -725,7 +725,7 @@ class flat_set //! Complexity: Logarithmic iterator upper_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic @@ -802,10 +802,10 @@ class flat_set //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value &&has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value &&has_trivial_destructor_after_move::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 Allocator = std::allocator > +template , class A = std::allocator > #else -template +template #endif class flat_multiset ///@cond - : public container_detail::flat_tree, Compare, Allocator> + : public container_detail::flat_tree, Compare, A> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_multiset) - typedef container_detail::flat_tree, Compare, Allocator> base_t; + typedef container_detail::flat_tree, 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_traits_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; }; namespace container { diff --git a/include/boost/container/list.hpp b/include/boost/container/list.hpp index c6de685..83fe5a4 100644 --- a/include/boost/container/list.hpp +++ b/include/boost/container/list.hpp @@ -84,10 +84,10 @@ struct iiterator_node_value_type< list_node > { typedef T type; }; -template +template struct intrusive_list_type { - typedef boost::container::allocator_traits allocator_traits_type; + typedef boost::container::allocator_traits allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; typedef typename boost::intrusive::pointer_traits ::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 > +template > #else -template +template #endif class list : protected container_detail::node_alloc_holder - ::type> + ::type> { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED typedef typename - container_detail::intrusive_list_type::type Icont; - typedef container_detail::node_alloc_holder AllocHolder; + container_detail::intrusive_list_type::type Icont; + typedef container_detail::node_alloc_holder 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_traits_type; - typedef boost::container::equal_to_value equal_to_value_type; + typedef boost::container::allocator_traits allocator_traits_type; + typedef boost::container::equal_to_value 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::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 //! //! Complexity: Linear to n. explicit list(size_type n) - : AllocHolder(Allocator()) + : AllocHolder(A()) { this->resize(n); } //! Effects: 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. //! //! Complexity: 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 //! //! Complexity: Linear to the range [first, last). template - 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. //! //! Complexity: Linear to the range [il.begin(), il.end()). - list(std::initializer_list il, const Allocator &a = Allocator()) + list(std::initializer_list 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 -struct has_trivial_destructor_after_move > - : public ::boost::has_trivial_destructor_after_move +template +struct has_trivial_destructor_after_move > + : public ::boost::has_trivial_destructor_after_move {}; namespace container { diff --git a/include/boost/container/map.hpp b/include/boost/container/map.hpp index e0c3835..50ce6ab 100644 --- a/include/boost/container/map.hpp +++ b/include/boost/container/map.hpp @@ -57,20 +57,20 @@ namespace container { //! \tparam Key is the key_type of the map //! \tparam Value is the mapped_type //! \tparam Compare is the ordering function for Keys (e.g. std::less). -//! \tparam Allocator is the allocator to allocate the value_types +//! \tparam A is the allocator to allocate the value_types //! (e.g. allocator< std::pair > ). //! \tparam MapOptions is an packed option type generated using using boost::container::tree_assoc_options. template < class Key, class T, class Compare = std::less - , 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 +template #endif class map ///@cond : public container_detail::tree < Key, std::pair , container_detail::select1st< std::pair > - , Compare, Allocator, MapOptions> + , Compare, A, MapOptions> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -79,7 +79,7 @@ class map typedef std::pair value_type_impl; typedef container_detail::tree - , Compare, Allocator, MapOptions> base_t; + , Compare, A, MapOptions> base_t; typedef container_detail::pair movable_value_type_impl; typedef container_detail::tree_value_compare < Key, value_type_impl, Compare, container_detail::select1st @@ -93,17 +93,17 @@ class map // ////////////////////////////////////////////// - typedef Key key_type; - typedef ::boost::container::allocator_traits allocator_traits_type; - typedef T mapped_type; - typedef std::pair value_type; - typedef typename boost::container::allocator_traits::pointer pointer; - typedef typename boost::container::allocator_traits::const_pointer const_pointer; - typedef typename boost::container::allocator_traits::reference reference; - typedef typename boost::container::allocator_traits::const_reference const_reference; - typedef typename boost::container::allocator_traits::size_type size_type; - typedef typename boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef Key key_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef T mapped_type; + typedef std::pair value_type; + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::const_pointer const_pointer; + typedef typename boost::container::allocator_traits::reference reference; + typedef typename boost::container::allocator_traits::const_reference const_reference; + typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::difference_type difference_type; + typedef 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -194,16 +194,16 @@ class map map(std::initializer_list 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } map(ordered_unique_range_t, std::initializer_list 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } #endif @@ -213,8 +213,8 @@ class map map(const map& x) : base_t(static_cast(x)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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(x), a) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: Makes *this a copy of x. @@ -283,7 +283,7 @@ class map #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Effects: Returns a copy of the Allocator that + //! Effects: Returns a copy of the allocator that //! was passed to the object's constructor. //! //! Complexity: 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 //! Complexity: Logarithmic. iterator find(const key_type& x); - //! Returns: Allocator const_iterator pointing to an element with the key + //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. @@ -726,7 +726,7 @@ class map //! Complexity: Logarithmic iterator lower_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic @@ -738,7 +738,7 @@ class map //! Complexity: Logarithmic iterator upper_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic @@ -835,10 +835,10 @@ class map //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; }; namespace container { @@ -859,20 +859,20 @@ namespace container { //! \tparam Key is the key_type of the map //! \tparam Value is the mapped_type //! \tparam Compare is the ordering function for Keys (e.g. std::less). -//! \tparam Allocator is the allocator to allocate the value_types +//! \tparam A is the allocator to allocate the value_types //! (e.g. allocator< std::pair > ). //! \tparam MultiMapOptions is an packed option type generated using using boost::container::tree_assoc_options. template < class Key, class T, class Compare = std::less - , 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 +template #endif class multimap ///@cond : public container_detail::tree < Key, std::pair , container_detail::select1st< std::pair > - , Compare, Allocator, MultiMapOptions> + , Compare, A, MultiMapOptions> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -881,7 +881,7 @@ class multimap typedef std::pair value_type_impl; typedef container_detail::tree - , Compare, Allocator, MultiMapOptions> base_t; + , Compare, A, MultiMapOptions> base_t; typedef container_detail::pair movable_value_type_impl; typedef container_detail::tree_value_compare < Key, value_type_impl, Compare, container_detail::select1st @@ -898,13 +898,13 @@ class multimap typedef Key key_type; typedef T mapped_type; typedef std::pair value_type; - typedef typename boost::container::allocator_traits::pointer pointer; - typedef typename boost::container::allocator_traits::const_pointer const_pointer; - typedef typename boost::container::allocator_traits::reference reference; - typedef typename boost::container::allocator_traits::const_reference const_reference; - typedef typename boost::container::allocator_traits::size_type size_type; - typedef typename boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::const_pointer const_pointer; + typedef typename boost::container::allocator_traits::reference reference; + typedef typename boost::container::allocator_traits::const_reference const_reference; + typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::difference_type difference_type; + typedef 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } multimap(ordered_range_t, std::initializer_list 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } #endif @@ -1011,8 +1011,8 @@ class multimap multimap(const multimap& x) : base_t(static_cast(x)) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: Copy constructs a multimap. @@ -1033,8 +1033,8 @@ class multimap multimap(const multimap& x, const allocator_type &a) : base_t(static_cast(x), a) { - //Allocator type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: 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 - BOOST_STATIC_ASSERT((container_detail::is_same, typename Allocator::value_type>::value)); + //A type must be std::pair + BOOST_STATIC_ASSERT((container_detail::is_same, typename A::value_type>::value)); } //! Effects: Makes *this a copy of x. @@ -1294,7 +1294,7 @@ class multimap //! Complexity: Logarithmic. iterator find(const key_type& x); - //! Returns: Allocator const iterator pointing to an element with the key + //! Returns: A const iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. @@ -1311,7 +1311,7 @@ class multimap //! Complexity: Logarithmic iterator lower_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic @@ -1323,7 +1323,7 @@ class multimap //! Complexity: Logarithmic iterator upper_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic @@ -1388,10 +1388,10 @@ class multimap //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; }; namespace container { diff --git a/include/boost/container/scoped_allocator.hpp b/include/boost/container/scoped_allocator.hpp index 92ad547..df3bcd3 100644 --- a/include/boost/container/scoped_allocator.hpp +++ b/include/boost/container/scoped_allocator.hpp @@ -48,10 +48,10 @@ namespace boost { namespace container { //! ill-formed. //! //! -//! template > +//! template > //! 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 > -//! struct constructible_with_allocator_suffix > +//! template > +//! struct constructible_with_allocator_suffix > //! : ::boost::true_type { }; //! //! -//! Note: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! Note: 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. //! //! -//! template > +//! template > //! 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 > -//! struct constructible_with_allocator_prefix > +//! template > +//! struct constructible_with_allocator_prefix > //! : ::boost::true_type { }; //! //! @@ -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: true_type if allocator_traits::propagate_on_container_copy_assignment::value is - //! true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. + //! Type: true_type if allocator_traits::propagate_on_container_copy_assignment::value is + //! true for any A in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. typedef typename base_type:: propagate_on_container_copy_assignment propagate_on_container_copy_assignment; - //! Type: true_type if allocator_traits::propagate_on_container_move_assignment::value is - //! true for any Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. + //! Type: true_type if allocator_traits::propagate_on_container_move_assignment::value is + //! true for any A in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. typedef typename base_type:: propagate_on_container_move_assignment propagate_on_container_move_assignment; - //! Type: true_type if allocator_traits::propagate_on_container_swap::value is true for any - //! Allocator in the set of OuterAlloc and InnerAllocs...; otherwise, false_type. + //! Type: true_type if allocator_traits::propagate_on_container_swap::value is true for any + //! A in the set of OuterAlloc and InnerAllocs...; 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 - //! Returns: Allocator new scoped_allocator_adaptor object where each allocator + //! Returns: A new scoped_allocator_adaptor object where each allocator //! A in the adaptor is initialized from the result of calling - //! allocator_traits::select_on_container_copy_construction() on + //! allocator_traits::select_on_container_copy_construction() on //! the corresponding allocator in *this. scoped_allocator_adaptor select_on_container_copy_construction() const; #endif //BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/include/boost/container/scoped_allocator_fwd.hpp b/include/boost/container/scoped_allocator_fwd.hpp index f19e27e..5392ef4 100644 --- a/include/boost/container/scoped_allocator_fwd.hpp +++ b/include/boost/container/scoped_allocator_fwd.hpp @@ -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 diff --git a/include/boost/container/set.hpp b/include/boost/container/set.hpp index 3579fef..4864a03 100644 --- a/include/boost/container/set.hpp +++ b/include/boost/container/set.hpp @@ -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 Allocator = std::allocator, class SetOptions = tree_assoc_defaults > +template , class A = std::allocator, class SetOptions = tree_assoc_defaults > #else -template +template #endif class set ///@cond : public container_detail::tree - < Key, Key, container_detail::identity, Compare, Allocator, SetOptions> + < Key, Key, container_detail::identity, Compare, A, SetOptions> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(set) typedef container_detail::tree - < Key, Key, container_detail::identity, Compare, Allocator, SetOptions> base_t; + < Key, Key, container_detail::identity, 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_traits_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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) - //! Effects: Returns a copy of the Allocator that + //! Effects: Returns a copy of the allocator that //! was passed to the object's constructor. //! //! Complexity: Constant. @@ -548,7 +548,7 @@ class set //! Complexity: Logarithmic. iterator find(const key_type& x); - //! Returns: Allocator const_iterator pointing to an element with the key + //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. @@ -576,7 +576,7 @@ class set //! Complexity: Logarithmic iterator lower_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic @@ -588,7 +588,7 @@ class set //! Complexity: Logarithmic iterator upper_bound(const key_type& x); - //! Returns: Allocator const iterator pointing to the first element with key not + //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic @@ -680,10 +680,10 @@ class set //!has_trivial_destructor_after_move<> == true_type //!specialization for optimizations -template -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::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 Allocator = std::allocator, class MultiSetOptions = tree_assoc_defaults > +template , class A = std::allocator, class MultiSetOptions = tree_assoc_defaults > #else -template +template #endif class multiset /// @cond : public container_detail::tree - , Compare, Allocator, MultiSetOptions> + , Compare, A, MultiSetOptions> /// @endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(multiset) typedef container_detail::tree - , Compare, Allocator, MultiSetOptions> base_t; + , 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_traits_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef ::boost::container::allocator_traits allocator_traits_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 -struct has_trivial_destructor_after_move > +template +struct has_trivial_destructor_after_move > { - static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; + static const bool value = has_trivial_destructor_after_move::value && has_trivial_destructor_after_move::value; }; namespace container { diff --git a/include/boost/container/slist.hpp b/include/boost/container/slist.hpp index a184971..35c794c 100644 --- a/include/boost/container/slist.hpp +++ b/include/boost/container/slist.hpp @@ -57,7 +57,7 @@ namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -template +template class slist; namespace container_detail { @@ -94,10 +94,10 @@ struct iiterator_node_value_type< slist_node > { typedef T type; }; -template +template struct intrusive_slist_type { - typedef boost::container::allocator_traits allocator_traits_type; + typedef boost::container::allocator_traits allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; typedef typename boost::intrusive::pointer_traits ::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 > +template > #else -template +template #endif class slist : protected container_detail::node_alloc_holder - ::type> + ::type> { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED typedef typename - container_detail::intrusive_slist_type::type Icont; - typedef container_detail::node_alloc_holder AllocHolder; + container_detail::intrusive_slist_type::type Icont; + typedef container_detail::node_alloc_holder 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_traits_type; - typedef boost::container::equal_to_value equal_to_value_type; + allocator_traits allocator_traits_type; + typedef boost::container::equal_to_value equal_to_value_type; BOOST_COPYABLE_AND_MOVABLE(slist) typedef container_detail::iterator_from_iiterator iterator_impl; @@ -193,13 +193,13 @@ class slist ////////////////////////////////////////////// typedef T value_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 -struct has_trivial_destructor_after_move > - : public ::boost::has_trivial_destructor_after_move +template +struct has_trivial_destructor_after_move > + : public ::boost::has_trivial_destructor_after_move {}; namespace container { @@ -1651,11 +1651,11 @@ namespace container { //there is no other way namespace std { -template -class insert_iterator > +template +class insert_iterator > { protected: - typedef boost::container::slist Container; + typedef boost::container::slist Container; Container* container; typename Container::iterator iter; public: diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index 6acc335..2f4f907 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -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 > +template > #else -template +template #endif class stable_vector { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef allocator_traits allocator_traits_type; + typedef allocator_traits allocator_traits_type; typedef boost::intrusive:: pointer_traits ptr_traits; @@ -458,7 +458,7 @@ class stable_vector integral_constant allocator_v2; typedef ::boost::container::container_detail::integral_constant ::value> alloc_version; + version::value> alloc_version; typedef typename allocator_traits_type:: template portable_rebind_alloc ::type node_allocator_type; @@ -481,10 +481,10 @@ class stable_vector friend class stable_vector_detail::clear_on_destroy; typedef stable_vector_iterator - < typename allocator_traits::pointer + < typename allocator_traits::pointer , false> iterator_impl; typedef stable_vector_iterator - < typename allocator_traits::pointer + < typename allocator_traits::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::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 -struct has_trivial_destructor_after_move > - : public has_trivial_destructor_after_move::value +template +struct has_trivial_destructor_after_move > + : public has_trivial_destructor_after_move::value {}; */ diff --git a/include/boost/container/string.hpp b/include/boost/container/string.hpp index 43a726b..3d654ca 100644 --- a/include/boost/container/string.hpp +++ b/include/boost/container/string.hpp @@ -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 +template class basic_string_base { basic_string_base & operator=(const basic_string_base &); basic_string_base(const basic_string_base &); - typedef allocator_traits allocator_traits_type; + typedef allocator_traits 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 explicit members_holder(BOOST_FWD_REF(AllocatorConvertible) a) - : Allocator(boost::forward(a)) + : A(boost::forward(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 allocator_v1; typedef container_detail::integral_constant allocator_v2; typedef container_detail::integral_constant::value> alloc_version; + boost::container::container_detail::version::value> alloc_version; std::pair 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::allocation_command + return container_detail::allocator_version_traits::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 Allocator = std::allocator > +template , class A = std::allocator > #else -template +template #endif class basic_string - : private container_detail::basic_string_base + : private container_detail::basic_string_base { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: - typedef allocator_traits allocator_traits_type; + typedef allocator_traits allocator_traits_type; BOOST_COPYABLE_AND_MOVABLE(basic_string) - typedef container_detail::basic_string_base base_t; + typedef container_detail::basic_string_base 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 struct Eq_traits @@ -535,13 +535,13 @@ class basic_string ////////////////////////////////////////////// typedef Traits traits_type; typedef CharT value_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 //! Requires: The program shall not alter any of the values stored in the character array. //! - //! Returns: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()]. + //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()]. //! //! Complexity: constant time. const CharT* c_str() const BOOST_CONTAINER_NOEXCEPT @@ -1915,7 +1915,7 @@ class basic_string //! Requires: The program shall not alter any of the values stored in the character array. //! - //! Returns: Allocator pointer p such that p + i == &operator[](i) for each i in [0,size()]. + //! Returns: A pointer p such that p + i == &operator[](i) for each i in [0,size()]. //! //! Complexity: constant time. const CharT* data() const BOOST_CONTAINER_NOEXCEPT @@ -1941,7 +1941,7 @@ class basic_string //! //! Throws: Nothing //! - //! Returns: find(basic_string(s,n),pos). + //! Returns: find(basic_string(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 //! Throws: Nothing //! - //! Returns: find(basic_string(1,c), pos). + //! Returns: find(basic_string(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 //! Throws: Nothing //! - //! Returns: rfind(basic_string(1,c),pos). + //! Returns: rfind(basic_string(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 //! //! Throws: Nothing //! - //! Returns: find_first_of(basic_string(1,c), pos). + //! Returns: find_first_of(basic_string(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 //! //! Throws: Nothing //! - //! Returns: find_last_of(basic_string(1,c),pos). + //! Returns: find_last_of(basic_string(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 //! //! Throws: If memory allocation throws or out_of_range if pos > size(). //! - //! Returns: basic_string(data()+pos,rlen). + //! Returns: basic_string(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 inline - basic_string - operator+(const basic_string& x - ,const basic_string& y) +template inline + basic_string + operator+(const basic_string& x + ,const basic_string& y) { - typedef basic_string str_t; + typedef basic_string 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 inline return result; } -template inline - basic_string operator+ - ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END x - , BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END y) +template inline + basic_string operator+ + ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END x + , BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END y) { x += y; return boost::move(x); } -template inline - basic_string operator+ - ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END x - , const basic_string& y) +template inline + basic_string operator+ + ( BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END x + , const basic_string& y) { x += y; return boost::move(x); } -template inline - basic_string operator+ - (const basic_string& x - ,BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END y) +template inline + basic_string operator+ + (const basic_string& x + ,BOOST_RV_REF_BEG basic_string BOOST_RV_REF_END y) { y.insert(y.begin(), x.begin(), x.end()); return boost::move(y); } -template inline - basic_string operator+ - (const CharT* s, basic_string y) +template inline + basic_string operator+ + (const CharT* s, basic_string y) { y.insert(y.begin(), s, s + Traits::length(s)); return y; } -template inline - basic_string operator+ - (basic_string x, const CharT* s) +template inline + basic_string operator+ + (basic_string x, const CharT* s) { x += s; return x; } -template inline - basic_string operator+ - (CharT c, basic_string y) +template inline + basic_string operator+ + (CharT c, basic_string y) { y.insert(y.begin(), c); return y; } -template inline - basic_string operator+ - (basic_string x, const CharT c) +template inline + basic_string operator+ + (basic_string x, const CharT c) { x += c; return x; @@ -2613,137 +2613,137 @@ template inline // Operator== and operator!= -template +template inline bool -operator==(const basic_string& x, - const basic_string& y) +operator==(const basic_string& x, + const basic_string& y) { return x.size() == y.size() && Traits::compare(x.data(), y.data(), x.size()) == 0; } -template +template inline bool -operator==(const CharT* s, const basic_string& y) +operator==(const CharT* s, const basic_string& y) { - typename basic_string::size_type n = Traits::length(s); + typename basic_string::size_type n = Traits::length(s); return n == y.size() && Traits::compare(s, y.data(), n) == 0; } -template +template inline bool -operator==(const basic_string& x, const CharT* s) +operator==(const basic_string& x, const CharT* s) { - typename basic_string::size_type n = Traits::length(s); + typename basic_string::size_type n = Traits::length(s); return x.size() == n && Traits::compare(x.data(), s, n) == 0; } -template +template inline bool -operator!=(const basic_string& x, - const basic_string& y) +operator!=(const basic_string& x, + const basic_string& y) { return !(x == y); } -template +template inline bool -operator!=(const CharT* s, const basic_string& y) +operator!=(const CharT* s, const basic_string& y) { return !(s == y); } -template +template inline bool -operator!=(const basic_string& x, const CharT* s) +operator!=(const basic_string& x, const CharT* s) { return !(x == s); } // Operator< (and also >, <=, and >=). -template +template inline bool -operator<(const basic_string& x, const basic_string& y) +operator<(const basic_string& x, const basic_string& y) { return x.compare(y) < 0; -// return basic_string +// return basic_string // ::s_compare(x.begin(), x.end(), y.begin(), y.end()) < 0; } -template +template inline bool -operator<(const CharT* s, const basic_string& y) +operator<(const CharT* s, const basic_string& y) { return y.compare(s) > 0; -// basic_string::size_type n = Traits::length(s); -// return basic_string +// basic_string::size_type n = Traits::length(s); +// return basic_string // ::s_compare(s, s + n, y.begin(), y.end()) < 0; } -template +template inline bool -operator<(const basic_string& x, +operator<(const basic_string& x, const CharT* s) { return x.compare(s) < 0; -// basic_string::size_type n = Traits::length(s); -// return basic_string +// basic_string::size_type n = Traits::length(s); +// return basic_string // ::s_compare(x.begin(), x.end(), s, s + n) < 0; } -template +template inline bool -operator>(const basic_string& x, - const basic_string& y) { +operator>(const basic_string& x, + const basic_string& y) { return y < x; } -template +template inline bool -operator>(const CharT* s, const basic_string& y) { +operator>(const CharT* s, const basic_string& y) { return y < s; } -template +template inline bool -operator>(const basic_string& x, const CharT* s) +operator>(const basic_string& x, const CharT* s) { return s < x; } -template +template inline bool -operator<=(const basic_string& x, - const basic_string& y) +operator<=(const basic_string& x, + const basic_string& y) { return !(y < x); } -template +template inline bool -operator<=(const CharT* s, const basic_string& y) +operator<=(const CharT* s, const basic_string& y) { return !(y < s); } -template +template inline bool -operator<=(const basic_string& x, const CharT* s) +operator<=(const basic_string& x, const CharT* s) { return !(s < x); } -template +template inline bool -operator>=(const basic_string& x, - const basic_string& y) +operator>=(const basic_string& x, + const basic_string& y) { return !(x < y); } -template +template inline bool -operator>=(const CharT* s, const basic_string& y) +operator>=(const CharT* s, const basic_string& y) { return !(s < y); } -template +template inline bool -operator>=(const basic_string& x, const CharT* s) +operator>=(const basic_string& x, const CharT* s) { return !(x < s); } // Swap. -template -inline void swap(basic_string& x, basic_string& y) +template +inline void swap(basic_string& x, basic_string& y) { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -2768,17 +2768,17 @@ string_fill(std::basic_ostream& os, } //namespace container_detail { #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -template +template std::basic_ostream& -operator<<(std::basic_ostream& os, const basic_string& s) +operator<<(std::basic_ostream& os, const basic_string& s) { typename std::basic_ostream::sentry sentry(os); bool ok = false; if (sentry) { ok = true; - typename basic_string::size_type n = s.size(); - typename basic_string::size_type pad_len = 0; + typename basic_string::size_type n = s.size(); + typename basic_string::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* buf = os.rdbuf(); @@ -2803,9 +2803,9 @@ operator<<(std::basic_ostream& os, const basic_string +template std::basic_istream& -operator>>(std::basic_istream& is, basic_string& s) +operator>>(std::basic_istream& is, basic_string& s) { typename std::basic_istream::sentry sentry(is); @@ -2850,11 +2850,11 @@ operator>>(std::basic_istream& is, basic_string +template std::basic_istream& -getline(std::istream& is, basic_string& s,CharT delim) +getline(std::istream& is, basic_string& s,CharT delim) { - typename basic_string::size_type nread = 0; + typename basic_string::size_type nread = 0; typename std::basic_istream::sentry sentry(is, true); if (sentry) { std::basic_streambuf* buf = is.rdbuf(); @@ -2882,15 +2882,15 @@ getline(std::istream& is, basic_string& s,CharT delim) return is; } -template +template inline std::basic_istream& -getline(std::basic_istream& is, basic_string& s) +getline(std::basic_istream& is, basic_string& s) { return getline(is, s, '\n'); } -template -inline std::size_t hash_value(basic_string, Allocator> const& v) +template +inline std::size_t hash_value(basic_string, 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 -struct has_trivial_destructor_after_move > - : public ::boost::has_trivial_destructor_after_move +template +struct has_trivial_destructor_after_move > + : public ::boost::has_trivial_destructor_after_move {}; } diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index 431a921..ad5fb25 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -239,54 +239,54 @@ struct vector_value_traits_base }; -template +template struct vector_value_traits - : public vector_value_traits_base + : public vector_value_traits_base { - typedef vector_value_traits_base base_t; + typedef vector_value_traits_base base_t; //This is the anti-exception array destructor //to deallocate values already constructed typedef typename container_detail::if_c - ,container_detail::scoped_destructor_n + ,container_detail::null_scoped_destructor_n + ,container_detail::scoped_destructor_n >::type ArrayDestructor; //This is the anti-exception array deallocator - typedef container_detail::scoped_array_deallocator ArrayDeallocator; + typedef container_detail::scoped_array_deallocator ArrayDeallocator; }; //!This struct deallocates and allocated memory -template < class Allocator - , class AllocatorVersion = typename container_detail::version::type +template < class A + , class AllocatorVersion = typename container_detail::version::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_traits_type; + typedef boost::container::allocator_traits 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::value) - : Allocator(), m_start(), m_size(), m_capacity() + BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value) + : A(), m_start(), m_size(), m_capacity() {} //Constructor, does not throw template explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT - : Allocator(boost::forward(a)), m_start(), m_size(), m_capacity() + : A(boost::forward(a)), m_start(), m_size(), m_capacity() {} //Constructor, does not throw template vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) - : Allocator(boost::forward(a)) + : A(boost::forward(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::allocation_command + return allocator_version_traits::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 -struct vector_alloc_holder > - : public Allocator +template +struct vector_alloc_holder > + : public A { private: BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder) public: - typedef boost::container::allocator_traits allocator_traits_type; + typedef boost::container::allocator_traits 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::value) - : Allocator(), m_size() + BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value) + : A(), m_size() {} //Constructor, does not throw template explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT - : Allocator(boost::forward(a)), m_size() + : A(boost::forward(a)), m_size() {} //Constructor, does not throw template vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) - : Allocator(boost::forward(a)) + : A(boost::forward(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 vector_alloc_holder(BOOST_RV_REF_BEG vector_alloc_holder 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::internal_capacity){ + if(cap > A::internal_capacity){ throw_bad_alloc(); } } @@ -480,7 +480,7 @@ struct vector_alloc_holder void swap(vector_alloc_holder &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 void priv_swap_members_impl(vector_alloc_holder &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) > +//! \tparam A The allocator used for all internal memory management +template ) > class vector { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef typename container_detail::version::type alloc_version; + typedef typename container_detail::version::type alloc_version; boost::container::container_detail::vector_alloc_holder - m_holder; - typedef allocator_traits allocator_traits_type; + m_holder; + typedef allocator_traits allocator_traits_type; template friend class vector; typedef typename ::boost::container::allocator_traits - ::pointer pointer_impl; + ::pointer pointer_impl; typedef container_detail::vec_iterator iterator_impl; typedef container_detail::vec_iterator const_iterator_impl; @@ -557,14 +557,14 @@ class vector ////////////////////////////////////////////// typedef T value_type; - typedef typename ::boost::container::allocator_traits::pointer pointer; - typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits::reference reference; - typedef typename ::boost::container::allocator_traits::const_reference const_reference; - typedef typename ::boost::container::allocator_traits::size_type size_type; - typedef typename ::boost::container::allocator_traits::difference_type difference_type; - typedef Allocator allocator_type; - typedef Allocator stored_allocator_type; + typedef typename ::boost::container::allocator_traits::pointer pointer; + typedef typename ::boost::container::allocator_traits::const_pointer const_pointer; + typedef typename ::boost::container::allocator_traits::reference reference; + typedef typename ::boost::container::allocator_traits::const_reference const_reference; + typedef typename ::boost::container::allocator_traits::size_type size_type; + typedef typename ::boost::container::allocator_traits::difference_type difference_type; + typedef 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 value_traits; + typedef container_detail::vector_value_traits value_traits; typedef container_detail::integral_constant allocator_v0; typedef container_detail::integral_constant allocator_v1; @@ -600,7 +600,7 @@ class vector //! //! Complexity: Constant. vector() - BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value) + BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor::value) : m_holder() {} @@ -609,7 +609,7 @@ class vector //! Throws: Nothing //! //! Complexity: 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(end_pos - container_detail::iterator_to_raw_pointer(cur)); this->priv_destroy_last_n(n); } @@ -1435,7 +1435,7 @@ class vector // ////////////////////////////////////////////// - //! Returns: Allocator pointer such that [data(),data() + size()) is a valid range. + //! Returns: A pointer such that [data(),data() + size()) is a valid range. //! For a non-empty vector, data() == &front(). //! //! Throws: Nothing. @@ -1444,7 +1444,7 @@ class vector T* data() BOOST_CONTAINER_NOEXCEPT { return container_detail::to_raw_pointer(this->m_holder.start()); } - //! Returns: Allocator pointer such that [data(),data() + size()) is a valid range. + //! Returns: A pointer such that [data(),data() + size()) is a valid range. //! For a non-empty vector, data() == &front(). //! //! Throws: 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) //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the end of the vector. //! @@ -1468,21 +1468,41 @@ class vector //! //! Complexity: Amortized constant time. template - 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)...); + allocator_traits_type::construct(this->m_holder.alloc(), this->back_raw(), ::boost::forward(args)...); ++this->m_holder.m_size; } else{ - typedef container_detail::insert_emplace_proxy type; + typedef container_detail::insert_emplace_proxy type; this->priv_forward_range_insert_no_capacity - (vector_iterator_get_ptr(this->cend()), 1, type(::boost::forward(args)...), alloc_version()); + (this->back_ptr(), 1, type(::boost::forward(args)...), alloc_version()); } } + //! Effects: Inserts an object of type T constructed with + //! std::forward(args)... in the end of the vector. + //! + //! Throws: If memory allocation throws or the in-place constructor throws or + //! T's copy/move constructor throws. + //! + //! Complexity: Constant time. + //! + //! Note: Non-standard extension. + template + 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)...); + ++this->m_holder.m_size; + } + return is_room_enough; + } + //! Requires: position must be a valid iterator of *this. //! //! Effects: Inserts an object of type T constructed with @@ -1494,49 +1514,237 @@ class vector //! Complexity: If position is end(), amortized constant time //! Linear time otherwise. template - 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 type; + typedef container_detail::insert_emplace_proxy type; return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1 , type(::boost::forward(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) \ - 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) \ - 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 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 type; + return this->priv_forward_range_insert + ( vector_iterator_get_ptr(pos), 1 + , type(), alloc_version()); + } + + //1 arg + template + 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)); + ++this->m_holder.m_size; + } + else{ + typedef container_detail::insert_emplace_proxy_arg1 type; + this->priv_forward_range_insert_no_capacity + ( this->back_ptr(), 1 + , type(::boost::forward(p0)), alloc_version()); + } + } + + template + 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)); + ++this->m_holder.m_size; + } + return is_room_enough; + } + + template + iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0) + { + typedef container_detail::insert_emplace_proxy_arg1 type; + return this->priv_forward_range_insert + ( vector_iterator_get_ptr(pos), 1 + , type(::boost::forward(p0)), alloc_version()); + } + + //2 arg + template + 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), ::boost::forward(p1)); + ++this->m_holder.m_size; + } + else{ + typedef container_detail::insert_emplace_proxy_arg2 type; + this->priv_forward_range_insert_no_capacity + ( this->back_ptr(), 1 + , type(::boost::forward(p0),::boost::forward(p1)), alloc_version()); + } + } + + template + 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), ::boost::forward(p1)); + ++this->m_holder.m_size; + } + return is_room_enough; + } + + template + iterator emplace(const_iterator pos, BOOST_FWD_REF(P0) p0, BOOST_FWD_REF(P1) p1) + { + typedef container_detail::insert_emplace_proxy_arg2 type; + return this->priv_forward_range_insert + ( vector_iterator_get_ptr(pos), 1 + , type(::boost::forward(p0), ::boost::forward(p1)), alloc_version()); + } + + //3 arg + template + 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), ::boost::forward(p1), ::boost::forward(p2)); + ++this->m_holder.m_size; + } + else{ + typedef container_detail::insert_emplace_proxy_arg3 type; + this->priv_forward_range_insert_no_capacity + ( this->back_ptr(), 1 + , type(::boost::forward(p0),::boost::forward(p1),::boost::forward(p2)), alloc_version()); + } + } + + template + 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), ::boost::forward(p1),::boost::forward(p2)); + ++this->m_holder.m_size; + } + return is_room_enough; + } + + template + 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 type; + return this->priv_forward_range_insert + ( vector_iterator_get_ptr(pos), 1 + , type(::boost::forward(p0), ::boost::forward(p1),::boost::forward(p2)), alloc_version()); + } + + //4 arg + template + 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), ::boost::forward(p1), ::boost::forward(p2), ::boost::forward(p3)); + ++this->m_holder.m_size; + } + else{ + typedef container_detail::insert_emplace_proxy_arg4 type; + this->priv_forward_range_insert_no_capacity + ( this->back_ptr(), 1 + , type(::boost::forward(p0),::boost::forward(p1),::boost::forward(p2),::boost::forward(p3)), alloc_version()); + } + } + + template + 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), ::boost::forward(p1), ::boost::forward(p2), ::boost::forward(p3)); + ++this->m_holder.m_size; + } + return is_room_enough; + } + + template + 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 type; + return this->priv_forward_range_insert + ( vector_iterator_get_ptr(pos), 1 + , type(::boost::forward(p0), ::boost::forward(p1),::boost::forward(p2),::boost::forward(p3)), alloc_version()); + } + + //5 arg + template + 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), ::boost::forward(p1), ::boost::forward(p2), ::boost::forward(p3), ::boost::forward(p4)); + ++this->m_holder.m_size; + } + else{ + typedef container_detail::insert_emplace_proxy_arg5 type; + this->priv_forward_range_insert_no_capacity + ( this->back_ptr(), 1 + , type(::boost::forward(p0),::boost::forward(p1),::boost::forward(p2),::boost::forward(p3),::boost::forward(p4)), alloc_version()); + } + } + + template + 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), ::boost::forward(p1), ::boost::forward(p2), ::boost::forward(p3)); + ++this->m_holder.m_size; + } + return is_room_enough; + } + + template + 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 type; + return this->priv_forward_range_insert + ( vector_iterator_get_ptr(pos), 1 + , type(::boost::forward(p0),::boost::forward(p1),::boost::forward(p2),::boost::forward(p3),::boost::forward(p4)), alloc_version()); + } #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING @@ -1596,7 +1804,7 @@ class vector //! Complexity: Linear to n. iterator insert(const_iterator p, size_type n, const T& x) { - container_detail::insert_n_copies_proxy proxy(x); + container_detail::insert_n_copies_proxy 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 proxy(first); + container_detail::insert_range_proxy 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::value || num == static_cast(boost::container::iterator_distance(first, last))); (void)last; - container_detail::insert_range_proxy proxy(first); + container_detail::insert_range_proxy proxy(first); return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy, alloc_version()); } #endif @@ -1719,9 +1927,9 @@ 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 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)); this->priv_destroy_last_n(old_end_ptr - ptr, last_ptr == old_end_ptr); } @@ -1733,7 +1941,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - void swap(vector& x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail::is_version::value)) + void swap(vector& x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail::is_version::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 //! Note: 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) - //! Effects: Inserts an object of type T constructed with - //! std::forward(args)... in the end of the vector. - //! - //! Throws: If memory allocation throws or the in-place constructor throws or - //! T's copy/move constructor throws. - //! - //! Complexity: Amortized constant time. - template - 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)...); - ++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, T*> priv_dummy_empty_proxy() + container_detail::insert_range_proxy, T*> priv_dummy_empty_proxy() { - return container_detail::insert_range_proxy, T*> + return container_detail::insert_range_proxy, 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 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 + ( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy (::boost::forward(x)), alloc_version()); } - container_detail::insert_copy_proxy priv_single_insert_proxy(const T &x) - { return container_detail::insert_copy_proxy (x); } + container_detail::insert_copy_proxy priv_single_insert_proxy(const T &x) + { return container_detail::insert_copy_proxy (x); } - container_detail::insert_move_proxy priv_single_insert_proxy(BOOST_RV_REF(T) x) - { return container_detail::insert_move_proxy (x); } + container_detail::insert_move_proxy priv_single_insert_proxy(BOOST_RV_REF(T) x) + { return container_detail::insert_move_proxy (x); } template 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)), alloc_version()); } } - container_detail::insert_n_copies_proxy priv_resize_proxy(const T &x) - { return container_detail::insert_n_copies_proxy(x); } + container_detail::insert_n_copies_proxy priv_resize_proxy(const T &x) + { return container_detail::insert_n_copies_proxy(x); } - container_detail::insert_default_initialized_n_proxy priv_resize_proxy(default_init_t) - { return container_detail::insert_default_initialized_n_proxy(); } + container_detail::insert_default_initialized_n_proxy priv_resize_proxy(default_init_t) + { return container_detail::insert_default_initialized_n_proxy(); } - container_detail::insert_value_initialized_n_proxy priv_resize_proxy(value_init_t) - { return container_detail::insert_value_initialized_n_proxy(); } + container_detail::insert_value_initialized_n_proxy priv_resize_proxy(value_init_t) + { return container_detail::insert_value_initialized_n_proxy(); } template 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 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 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 -struct has_trivial_destructor_after_move > - : public ::boost::has_trivial_destructor_after_move +template +struct has_trivial_destructor_after_move > + : public ::boost::has_trivial_destructor_after_move {}; */ } @@ -3034,8 +3208,8 @@ struct has_trivial_destructor_after_move namespace std { -template -inline void swap(boost::container::vector& x, boost::container::vector& y) +template +inline void swap(boost::container::vector& x, boost::container::vector& y) { x.swap(y); } } //namespace std {