Introducing allocator_traits and pointer_traits changes into several libraries.

[SVN r76106]
This commit is contained in:
Ion Gaztañaga committed 2011-12-22 20:08:24 +00:00
1 parent 5247083184
commit 935a534713
41 files changed
+4304 -2448

No files matched your search

+59 -52
View File
@@ -8,8 +8,8 @@
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_CONTAINERS_SET_HPP
#define BOOST_CONTAINERS_SET_HPP
#ifndef BOOST_CONTAINER_SET_HPP
#define BOOST_CONTAINER_SET_HPP
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
# pragma once
@@ -27,7 +27,7 @@
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/tree.hpp>
#include <boost/move/move.hpp>
#ifndef BOOST_CONTAINERS_PERFECT_FORWARDING
#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
#include <boost/container/detail/preprocessor.hpp>
#endif
@@ -67,10 +67,10 @@ class set
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(set)
typedef containers_detail::rbtree<T, T,
containers_detail::identity<T>, Pred, A> tree_t;
typedef container_detail::rbtree<T, T,
container_detail::identity<T>, Pred, A> tree_t;
tree_t m_tree; // red-black tree representing set
typedef typename containers_detail::
typedef typename container_detail::
move_const_ref_type<T>::type insert_const_ref_type;
/// @endcond
@@ -94,11 +94,18 @@ class set
typedef typename tree_t::allocator_type allocator_type;
typedef typename tree_t::stored_allocator_type stored_allocator_type;
//! <b>Effects</b>: Default constructs an empty set.
//!
//! <b>Complexity</b>: Constant.
set()
: m_tree()
{}
//! <b>Effects</b>: Constructs an empty set using the specified comparison object
//! and allocator.
//!
//! <b>Complexity</b>: Constant.
explicit set(const Pred& comp = Pred(),
explicit set(const Pred& comp,
const allocator_type& a = allocator_type())
: m_tree(comp, a)
{}
@@ -334,7 +341,7 @@ class 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
@@ -366,7 +373,7 @@ class 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
@@ -389,7 +396,7 @@ class set
void insert(InputIterator first, InputIterator last)
{ m_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
@@ -418,27 +425,23 @@ class set
iterator emplace_hint(const_iterator hint, Args&&... args)
{ return m_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_tree.emplace_unique(); }
iterator emplace_hint(const_iterator hint)
{ return m_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_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_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_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_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 p.
//!
@@ -629,10 +632,10 @@ class multiset
/// @cond
private:
BOOST_COPYABLE_AND_MOVABLE(multiset)
typedef containers_detail::rbtree<T, T,
containers_detail::identity<T>, Pred, A> tree_t;
typedef container_detail::rbtree<T, T,
container_detail::identity<T>, Pred, A> tree_t;
tree_t m_tree; // red-black tree representing multiset
typedef typename containers_detail::
typedef typename container_detail::
move_const_ref_type<T>::type insert_const_ref_type;
/// @endcond
@@ -660,7 +663,15 @@ class multiset
//! object and allocator.
//!
//! <b>Complexity</b>: Constant.
explicit multiset(const Pred& comp = Pred(),
multiset()
: m_tree()
{}
//! <b>Effects</b>: Constructs an empty multiset using the specified comparison
//! object and allocator.
//!
//! <b>Complexity</b>: Constant.
explicit multiset(const Pred& comp,
const allocator_type& a = allocator_type())
: m_tree(comp, a)
{}
@@ -893,7 +904,7 @@ class 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
@@ -923,7 +934,7 @@ class 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
@@ -947,7 +958,7 @@ class multiset
void insert(InputIterator first, InputIterator last)
{ m_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
@@ -970,27 +981,23 @@ class multiset
iterator emplace_hint(const_iterator hint, Args&&... args)
{ return m_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_tree.emplace_equal(); }
iterator emplace_hint(const_iterator hint)
{ return m_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_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_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_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_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 p.
//!
@@ -1159,5 +1166,5 @@ namespace container {
#include <boost/container/detail/config_end.hpp>
#endif /* BOOST_CONTAINERS_SET_HPP */
#endif /* BOOST_CONTAINER_SET_HPP */