Introducing allocator_traits and pointer_traits changes into several libraries.

[SVN r76106]
This commit is contained in:
Ion Gaztañaga
2011-12-22 20:08:24 +00:00
parent 5247083184
commit 935a534713
41 changed files with 4304 additions and 2448 deletions
+55 -50
View File
@@ -8,8 +8,8 @@
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINERS_FLAT_SET_HPP
#define BOOST_CONTAINERS_FLAT_SET_HPP
#ifndef BOOST_CONTAINER_FLAT_SET_HPP
#define BOOST_CONTAINER_FLAT_SET_HPP
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
# pragma once
@@ -74,9 +74,9 @@ class flat_set
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(flat_set)
typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, A> tree_t;
typedef container_detail::flat_tree<T, T, container_detail::identity<T>, Pred, A> tree_t;
tree_t m_flat_tree; // flat tree representing flat_set
typedef typename containers_detail::
typedef typename container_detail::
move_const_ref_type<T>::type insert_const_ref_type;
/// @endcond
@@ -100,11 +100,18 @@ class flat_set
typedef typename tree_t::allocator_type allocator_type;
typedef typename tree_t::stored_allocator_type stored_allocator_type;
//! <b>Effects</b>: Defatuls constructs an empty flat_map.
//!
//! <b>Complexity</b>: Constant.
explicit flat_set()
: m_flat_tree()
{}
//! <b>Effects</b>: Constructs an empty flat_map using the specified
//! comparison object and allocator.
//!
//! <b>Complexity</b>: Constant.
explicit flat_set(const Pred& comp = Pred(),
explicit flat_set(const Pred& comp,
const allocator_type& a = allocator_type())
: m_flat_tree(comp, a)
{}
@@ -344,7 +351,7 @@ class flat_set
{ return this->insert(const_cast<const T &>(x)); }
template<class U>
std::pair<iterator, bool> insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
std::pair<iterator, bool> insert(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(u); }
#endif
@@ -381,7 +388,7 @@ class flat_set
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(position, u); }
#endif
@@ -410,7 +417,7 @@ class flat_set
void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_unique(first, last); }
#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... if and only if there is no element in the container
@@ -444,27 +451,23 @@ class flat_set
iterator emplace_hint(const_iterator hint, Args&&... args)
{ return m_flat_tree.emplace_hint_unique(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
iterator emplace()
{ return m_flat_tree.emplace_unique(); }
iterator emplace_hint(const_iterator hint)
{ return m_flat_tree.emplace_hint_unique(hint); }
#define BOOST_PP_LOCAL_MACRO(n) \
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
\
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_hint_unique(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); }\
#define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_unique(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace_hint(const_iterator hint \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_hint_unique \
(hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
//!
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
#endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
//! <b>Effects</b>: Erases the element pointed to by position.
//!
@@ -702,9 +705,9 @@ class flat_multiset
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(flat_multiset)
typedef containers_detail::flat_tree<T, T, containers_detail::identity<T>, Pred, A> tree_t;
typedef container_detail::flat_tree<T, T, container_detail::identity<T>, Pred, A> tree_t;
tree_t m_flat_tree; // flat tree representing flat_multiset
typedef typename containers_detail::
typedef typename container_detail::
move_const_ref_type<T>::type insert_const_ref_type;
/// @endcond
@@ -727,8 +730,14 @@ class flat_multiset
typedef typename tree_t::allocator_type allocator_type;
typedef typename tree_t::stored_allocator_type stored_allocator_type;
// allocation/deallocation
explicit flat_multiset(const Pred& comp = Pred(),
//! <b>Effects</b>: Defatuls constructs an empty flat_map.
//!
//! <b>Complexity</b>: Constant.
explicit flat_multiset()
: m_flat_tree()
{}
explicit flat_multiset(const Pred& comp,
const allocator_type& a = allocator_type())
: m_flat_tree(comp, a) {}
@@ -943,7 +952,7 @@ class flat_multiset
{ return this->insert(const_cast<const T &>(x)); }
template<class U>
iterator insert(const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
iterator insert(const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(u); }
#endif
@@ -975,7 +984,7 @@ class flat_multiset
{ return this->insert(position, const_cast<const T &>(x)); }
template<class U>
iterator insert(const_iterator position, const U &u, typename containers_detail::enable_if_c<containers_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
iterator insert(const_iterator position, const U &u, typename container_detail::enable_if_c<container_detail::is_same<T, U>::value && !::boost::has_move_emulation_enabled<U>::value >::type* =0)
{ return priv_insert(position, u); }
#endif
@@ -1004,7 +1013,7 @@ class flat_multiset
void insert(InputIterator first, InputIterator last)
{ m_flat_tree.insert_equal(first, last); }
#if defined(BOOST_CONTAINERS_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: Inserts an object of type T constructed with
//! std::forward<Args>(args)... and returns the iterator pointing to the
@@ -1033,27 +1042,23 @@ class flat_multiset
iterator emplace_hint(const_iterator hint, Args&&... args)
{ return m_flat_tree.emplace_hint_equal(hint, boost::forward<Args>(args)...); }
#else //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
iterator emplace()
{ return m_flat_tree.emplace_equal(); }
iterator emplace_hint(const_iterator hint)
{ return m_flat_tree.emplace_hint_equal(hint); }
#define BOOST_PP_LOCAL_MACRO(n) \
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
\
template<BOOST_PP_ENUM_PARAMS(n, class P)> \
iterator emplace_hint(const_iterator hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_hint_equal(hint, BOOST_PP_ENUM(n, BOOST_CONTAINERS_PP_PARAM_FORWARD, _)); } \
#define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_equal(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
\
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
iterator emplace_hint(const_iterator hint \
BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
{ return m_flat_tree.emplace_hint_equal \
(hint BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \
//!
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINERS_MAX_CONSTRUCTOR_PARAMETERS)
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
#endif //#ifdef BOOST_CONTAINERS_PERFECT_FORWARDING
#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
//! <b>Effects</b>: Erases the element pointed to by position.
//!
@@ -1258,4 +1263,4 @@ namespace container {
#include <boost/container/detail/config_end.hpp>
#endif /* BOOST_CONTAINERS_FLAT_SET_HPP */
#endif /* BOOST_CONTAINER_FLAT_SET_HPP */