mirror of
https://github.com/boostorg/unordered.git
synced 2026-08-07 06:04:07 +02:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9265e1c42a |
@@ -170,9 +170,4 @@ C++11 support has resulted in some breaking changes:
|
||||
the variadic consturctors define
|
||||
`BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT`.
|
||||
|
||||
[h2 Boost 1.49.0]
|
||||
|
||||
* Fix warning due to accidental odd assignment.
|
||||
* Slightly better error messages.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -26,10 +26,6 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/utility/addressof.hpp>
|
||||
|
||||
#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS)
|
||||
#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0
|
||||
#endif
|
||||
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
# include <memory>
|
||||
#endif
|
||||
@@ -202,8 +198,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <typename Alloc, typename T>
|
||||
struct rebind_wrap
|
||||
{
|
||||
typedef typename std::allocator_traits<Alloc>::
|
||||
template rebind_alloc<T> type;
|
||||
typedef typename std::allocator_traits<Alloc>::rebind_alloc<T> type;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
@@ -40,7 +40,20 @@
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES) && \
|
||||
!defined(BOOST_NO_VARIADIC_TEMPLATES)
|
||||
#define BOOST_UNORDERED_VARIADIC_MOVE
|
||||
# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
|
||||
# elif defined(_LIBCPP_VERSION)
|
||||
# define BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
# elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20090804
|
||||
# define BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
# endif
|
||||
# elif defined(__STL_CONFIG_H)
|
||||
# elif defined(__MSL_CPP__)
|
||||
# elif defined(__IBMCPP__)
|
||||
# elif defined(MSIPL_COMPILE_H)
|
||||
# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost { namespace unordered { namespace detail {
|
||||
@@ -51,11 +64,11 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// Either forwarding variadic arguments, or storing the arguments in
|
||||
// emplace_args##n
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args
|
||||
#define BOOST_UNORDERED_EMPLACE_ARGS Args&&... args
|
||||
#define BOOST_UNORDERED_EMPLACE_FORWARD boost::forward<Args>(args)...
|
||||
#define BOOST_UNORDERED_EMPLACE_FORWARD std::forward<Args>(args)...
|
||||
|
||||
#else
|
||||
|
||||
@@ -160,8 +173,6 @@ BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, BOOST_UNORDERED_EARGS,
|
||||
//
|
||||
// Used for piecewise construction.
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590)
|
||||
|
||||
#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \
|
||||
template<typename T> \
|
||||
void construct_from_tuple(T* ptr, namespace_::tuple<>) \
|
||||
@@ -195,49 +206,6 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL
|
||||
#undef BOOST_UNORDERED_GET_TUPLE_ARG
|
||||
|
||||
#else
|
||||
|
||||
template <int N> struct length {};
|
||||
|
||||
template<typename T>
|
||||
void construct_from_tuple_impl(
|
||||
boost::unordered::detail::length<0>, T* ptr,
|
||||
boost::tuple<>)
|
||||
{
|
||||
new ((void*) ptr) T();
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL(z, n, _) \
|
||||
template<typename T, BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \
|
||||
void construct_from_tuple_impl( \
|
||||
boost::unordered::detail::length<n>, T* ptr, \
|
||||
namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \
|
||||
{ \
|
||||
new ((void*) ptr) T( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_) \
|
||||
); \
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, _) \
|
||||
boost::get<n>(x)
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1, 10, \
|
||||
BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL, _)
|
||||
|
||||
template <typename T, typename Tuple>
|
||||
void construct_from_tuple(T* ptr, Tuple const& x)
|
||||
{
|
||||
construct_from_tuple_impl(
|
||||
boost::unordered::detail::length<
|
||||
boost::tuples::length<Tuple>::value>(),
|
||||
ptr, x);
|
||||
}
|
||||
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL
|
||||
#undef BOOST_UNORDERED_GET_TUPLE_ARG
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SFINAE traits for construction.
|
||||
|
||||
@@ -289,7 +257,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Construct from variadic parameters
|
||||
@@ -297,7 +265,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
template <typename T, typename... Args>
|
||||
inline void construct_impl(T* address, Args&&... args)
|
||||
{
|
||||
new((void*) address) T(boost::forward<Args>(args)...);
|
||||
new((void*) address) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename A, typename B, typename A0, typename A1, typename A2>
|
||||
@@ -316,7 +284,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
inline typename enable_if<emulation1<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address, A0&& a0)
|
||||
{
|
||||
new((void*) boost::addressof(address->first)) A(boost::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->second)) B();
|
||||
}
|
||||
|
||||
@@ -324,10 +292,10 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
inline typename enable_if<emulation3<A, B, A0>, void>::type
|
||||
construct_impl(std::pair<A, B>* address, A0&& a0, A1&& a1, A2&& a2)
|
||||
{
|
||||
new((void*) boost::addressof(address->first)) A(boost::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->second)) B(
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2));
|
||||
std::forward<A1>(a1),
|
||||
std::forward<A2>(a2));
|
||||
}
|
||||
|
||||
template <typename A, typename B,
|
||||
@@ -336,17 +304,17 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
inline void construct_impl(std::pair<A, B>* address,
|
||||
A0&& a0, A1&& a1, A2&& a2, A3&& a3, Args&&... args)
|
||||
{
|
||||
new((void*) boost::addressof(address->first)) A(boost::forward<A0>(a0));
|
||||
new((void*) boost::addressof(address->first)) A(std::forward<A0>(a0));
|
||||
|
||||
new((void*) boost::addressof(address->second)) B(
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2),
|
||||
boost::forward<A3>(a3),
|
||||
boost::forward<Args>(args)...);
|
||||
std::forward<A1>(a1),
|
||||
std::forward<A2>(a2),
|
||||
std::forward<A3>(a3),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
|
||||
#else // BOOST_UNORDERED_VARIADIC_MOVE
|
||||
#else // BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Construct from emplace_args
|
||||
@@ -366,32 +334,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
args.a)); \
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
inline void construct_impl(T* address, emplace_args1<A0> const& args)
|
||||
{
|
||||
new((void*) address) T(boost::forward<A0>(args.a0));
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1>
|
||||
inline void construct_impl(T* address, emplace_args2<A0, A1> const& args)
|
||||
{
|
||||
new((void*) address) T(
|
||||
boost::forward<A0>(args.a0),
|
||||
boost::forward<A1>(args.a1)
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
inline void construct_impl(T* address, emplace_args3<A0, A1, A2> const& args)
|
||||
{
|
||||
new((void*) address) T(
|
||||
boost::forward<A0>(args.a0),
|
||||
boost::forward<A1>(args.a1),
|
||||
boost::forward<A2>(args.a2)
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_CONSTRUCT_IMPL, _)
|
||||
|
||||
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
|
||||
@@ -458,7 +401,7 @@ BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std)
|
||||
#undef BOOST_UNORDERED_CALL_FORWARD2
|
||||
|
||||
#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT
|
||||
#endif // BOOST_UNORDERED_VARIADIC_MOVE
|
||||
#endif // BOOST_UNORDERED_STD_FORWARD_MOVE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Construct without using the emplace args mechanism.
|
||||
|
||||
@@ -115,21 +115,20 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
};
|
||||
|
||||
template <typename A, typename T, typename H, typename P>
|
||||
template <typename A, typename H, typename P>
|
||||
struct multiset
|
||||
{
|
||||
typedef boost::unordered::detail::multiset<A, T, H, P> types;
|
||||
typedef boost::unordered::detail::multiset<A, H, P> types;
|
||||
|
||||
typedef T value_type;
|
||||
typedef A allocator;
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
typedef T key_type;
|
||||
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
A, value_type>::type allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef value_type key_type;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
typedef boost::unordered::detail::pick_grouped_node<allocator, value_type> pick;
|
||||
typedef boost::unordered::detail::pick_grouped_node<A, value_type> pick;
|
||||
typedef typename pick::node node;
|
||||
typedef typename pick::bucket bucket;
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
@@ -138,21 +137,20 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef boost::unordered::detail::set_extractor<value_type> extractor;
|
||||
};
|
||||
|
||||
template <typename A, typename K, typename M, typename H, typename P>
|
||||
template <typename A, typename K, typename H, typename P>
|
||||
struct multimap
|
||||
{
|
||||
typedef boost::unordered::detail::multimap<A, K, M, H, P> types;
|
||||
typedef boost::unordered::detail::multimap<A, K, H, P> types;
|
||||
|
||||
typedef std::pair<K const, M> value_type;
|
||||
typedef A allocator;
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
typedef K key_type;
|
||||
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
A, value_type>::type allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
typedef boost::unordered::detail::pick_grouped_node<allocator, value_type> pick;
|
||||
typedef boost::unordered::detail::pick_grouped_node<A, value_type> pick;
|
||||
typedef typename pick::node node;
|
||||
typedef typename pick::bucket bucket;
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
@@ -453,22 +451,22 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
iterator emplace(boost::unordered::detail::emplace_args1<
|
||||
node_pointer emplace(boost::unordered::detail::emplace_args1<
|
||||
boost::unordered::detail::please_ignore_this_overload> const&)
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
return iterator();
|
||||
return this->begin();
|
||||
}
|
||||
#endif
|
||||
|
||||
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
node_pointer emplace(BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
node_constructor a(this->node_alloc());
|
||||
a.construct_node();
|
||||
a.construct_value(BOOST_UNORDERED_EMPLACE_FORWARD);
|
||||
|
||||
return iterator(emplace_impl(a));
|
||||
return emplace_impl(a);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -51,17 +51,25 @@ namespace detail {
|
||||
return v;
|
||||
}
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
static key_type const& extract(BOOST_RV_REF(key_type) v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
#endif
|
||||
|
||||
static no_key extract()
|
||||
{
|
||||
return no_key();
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <class... Args>
|
||||
static no_key extract(Args const&...)
|
||||
{
|
||||
return no_key();
|
||||
}
|
||||
|
||||
#else
|
||||
template <class Arg>
|
||||
static no_key extract(Arg const&)
|
||||
@@ -98,6 +106,13 @@ namespace detail {
|
||||
return v;
|
||||
}
|
||||
|
||||
// TODO: Why does this cause errors?
|
||||
//
|
||||
//static key_type const& extract(BOOST_RV_REF(key_type) v)
|
||||
//{
|
||||
// return v;
|
||||
//}
|
||||
|
||||
template <class Second>
|
||||
static key_type const& extract(std::pair<key_type, Second> const& v)
|
||||
{
|
||||
@@ -111,7 +126,7 @@ namespace detail {
|
||||
return v.first;
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <class Arg1, class... Args>
|
||||
static key_type const& extract(key_type const& k,
|
||||
Arg1 const&, Args const&...)
|
||||
@@ -150,7 +165,7 @@ namespace detail {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \
|
||||
template <typename T2> \
|
||||
|
||||
@@ -174,13 +174,13 @@ namespace boost { namespace unordered { namespace iterator_detail {
|
||||
}
|
||||
|
||||
iterator& operator++() {
|
||||
node_ = static_cast<node_pointer>(node_->next_);
|
||||
node_ = node_ = static_cast<node_pointer>(node_->next_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
iterator operator++(int) {
|
||||
iterator tmp(node_);
|
||||
node_ = static_cast<node_pointer>(node_->next_);
|
||||
node_ = node_ = static_cast<node_pointer>(node_->next_);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace boost { namespace unordered { namespace iterator_detail {
|
||||
|
||||
c_iterator operator++(int) {
|
||||
c_iterator tmp(node_);
|
||||
node_ = static_cast<node_pointer>(node_->next_);
|
||||
node_ = node_ = static_cast<node_pointer>(node_->next_);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,21 +111,20 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
};
|
||||
|
||||
template <typename A, typename T, typename H, typename P>
|
||||
template <typename A, typename H, typename P>
|
||||
struct set
|
||||
{
|
||||
typedef boost::unordered::detail::set<A, T, H, P> types;
|
||||
typedef boost::unordered::detail::set<A, H, P> types;
|
||||
|
||||
typedef T value_type;
|
||||
typedef A allocator;
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
typedef T key_type;
|
||||
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
A, value_type>::type allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
typedef value_type key_type;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
|
||||
typedef boost::unordered::detail::pick_node<A, value_type> pick;
|
||||
typedef typename pick::node node;
|
||||
typedef typename pick::bucket bucket;
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
@@ -134,21 +133,20 @@ namespace boost { namespace unordered { namespace detail {
|
||||
typedef boost::unordered::detail::set_extractor<value_type> extractor;
|
||||
};
|
||||
|
||||
template <typename A, typename K, typename M, typename H, typename P>
|
||||
template <typename A, typename K, typename H, typename P>
|
||||
struct map
|
||||
{
|
||||
typedef boost::unordered::detail::map<A, K, M, H, P> types;
|
||||
typedef boost::unordered::detail::map<A, K, H, P> types;
|
||||
|
||||
typedef std::pair<K const, M> value_type;
|
||||
typedef A allocator;
|
||||
typedef H hasher;
|
||||
typedef P key_equal;
|
||||
typedef K key_type;
|
||||
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
A, value_type>::type allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<A> traits;
|
||||
typedef typename traits::value_type value_type;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
|
||||
typedef boost::unordered::detail::pick_node<A, value_type> pick;
|
||||
typedef typename pick::node node;
|
||||
typedef typename pick::bucket bucket;
|
||||
typedef typename pick::link_pointer link_pointer;
|
||||
@@ -337,7 +335,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// exception (need strong safety in such a case).
|
||||
node_constructor a(this->node_alloc());
|
||||
a.construct_node();
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
a.construct_value(boost::unordered::piecewise_construct,
|
||||
boost::make_tuple(k), boost::make_tuple());
|
||||
#else
|
||||
@@ -364,7 +362,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
|
||||
emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS)
|
||||
{
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
return emplace_impl(
|
||||
extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD),
|
||||
BOOST_UNORDERED_EMPLACE_FORWARD);
|
||||
@@ -376,7 +374,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if !defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <typename A0>
|
||||
emplace_return emplace(
|
||||
boost::unordered::detail::emplace_args1<A0> const& args)
|
||||
|
||||
@@ -41,9 +41,7 @@ namespace unordered
|
||||
template <class K, class T, class H, class P, class A>
|
||||
class unordered_map
|
||||
{
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
BOOST_COPYABLE_AND_MOVABLE(unordered_map)
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
@@ -56,9 +54,15 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef boost::unordered::detail::map<A, K, T, H, P> types;
|
||||
typedef typename types::allocator value_allocator;
|
||||
typedef typename types::traits allocator_traits;
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef boost::unordered::detail::map<value_allocator, K, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
public:
|
||||
@@ -80,7 +84,7 @@ namespace unordered
|
||||
private:
|
||||
|
||||
table table_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// constructors
|
||||
@@ -117,17 +121,10 @@ namespace unordered
|
||||
|
||||
unordered_map(unordered_map const&, allocator_type const&);
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_map(BOOST_RV_REF(unordered_map) other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#elif !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_map(unordered_map&& other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_map(unordered_map&&, allocator_type const&);
|
||||
@@ -148,7 +145,6 @@ namespace unordered
|
||||
|
||||
// Assign
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_map& operator=(BOOST_COPY_ASSIGN_REF(unordered_map) x)
|
||||
{
|
||||
table_.assign(x.table_);
|
||||
@@ -160,21 +156,6 @@ namespace unordered
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
unordered_map& operator=(unordered_map const& x)
|
||||
{
|
||||
table_.assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_map& operator=(unordered_map&& x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_map& operator=(std::initializer_list<value_type>);
|
||||
@@ -233,115 +214,20 @@ namespace unordered
|
||||
|
||||
// emplace
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace(Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return table_.emplace(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator, Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...).first;
|
||||
return iterator(table_.emplace(std::forward<Args>(args)...).first);
|
||||
}
|
||||
#else
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
// 0 argument emplace requires special treatment in case
|
||||
// the container is instantiated with a value type that
|
||||
// doesn't have a default constructor.
|
||||
|
||||
std::pair<iterator, bool> emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type())
|
||||
{
|
||||
return this->emplace(boost::move(v));
|
||||
}
|
||||
|
||||
iterator emplace_hint(const_iterator hint,
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type()
|
||||
)
|
||||
{
|
||||
return this->emplace_hint(hint, boost::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
).first;
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
).first;
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
).first;
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
@@ -365,18 +251,39 @@ namespace unordered
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
return iterator(table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)).first; \
|
||||
)).first); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
std::pair<iterator, bool> emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type())
|
||||
{
|
||||
return this->emplace(boost::move(v));
|
||||
}
|
||||
|
||||
iterator emplace_hint(const_iterator hint,
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type()
|
||||
)
|
||||
{
|
||||
return this->emplace_hint(hint, boost::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool> insert(value_type const& x)
|
||||
@@ -526,9 +433,8 @@ namespace unordered
|
||||
template <class K, class T, class H, class P, class A>
|
||||
class unordered_multimap
|
||||
{
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
BOOST_COPYABLE_AND_MOVABLE(unordered_multimap)
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
typedef K key_type;
|
||||
@@ -540,9 +446,15 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef boost::unordered::detail::multimap<A, K, T, H, P> types;
|
||||
typedef typename types::allocator value_allocator;
|
||||
typedef typename types::traits allocator_traits;
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef boost::unordered::detail::multimap<value_allocator, K, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
public:
|
||||
@@ -601,17 +513,10 @@ namespace unordered
|
||||
|
||||
unordered_multimap(unordered_multimap const&, allocator_type const&);
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_multimap(BOOST_RV_REF(unordered_multimap) other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#elif !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multimap(unordered_multimap&& other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multimap(unordered_multimap&&, allocator_type const&);
|
||||
@@ -632,7 +537,6 @@ namespace unordered
|
||||
|
||||
// Assign
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_multimap& operator=(
|
||||
BOOST_COPY_ASSIGN_REF(unordered_multimap) x)
|
||||
{
|
||||
@@ -645,21 +549,6 @@ namespace unordered
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
unordered_multimap& operator=(unordered_multimap const& x)
|
||||
{
|
||||
table_.assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multimap& operator=(unordered_multimap&& x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_multimap& operator=(std::initializer_list<value_type>);
|
||||
@@ -718,115 +607,20 @@ namespace unordered
|
||||
|
||||
// emplace
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <class... Args>
|
||||
iterator emplace(Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return iterator(table_.emplace(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator, Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return iterator(table_.emplace(std::forward<Args>(args)...));
|
||||
}
|
||||
#else
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
// 0 argument emplace requires special treatment in case
|
||||
// the container is instantiated with a value type that
|
||||
// doesn't have a default constructor.
|
||||
|
||||
iterator emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type())
|
||||
{
|
||||
return this->emplace(boost::move(v));
|
||||
}
|
||||
|
||||
iterator emplace_hint(const_iterator hint,
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type()
|
||||
)
|
||||
{
|
||||
return this->emplace_hint(hint, boost::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
);
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
@@ -835,11 +629,11 @@ namespace unordered
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
return iterator(table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)); \
|
||||
))); \
|
||||
} \
|
||||
\
|
||||
template < \
|
||||
@@ -850,18 +644,39 @@ namespace unordered
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
return iterator(table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)); \
|
||||
))); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
iterator emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type())
|
||||
{
|
||||
return iterator(this->emplace(boost::move(v)));
|
||||
}
|
||||
|
||||
iterator emplace_hint(const_iterator hint,
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type()
|
||||
)
|
||||
{
|
||||
return iterator(this->emplace_hint(hint, boost::move(v)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
iterator insert(value_type const& x)
|
||||
|
||||
@@ -41,9 +41,7 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
class unordered_set
|
||||
{
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
BOOST_COPYABLE_AND_MOVABLE(unordered_set)
|
||||
#endif
|
||||
public:
|
||||
|
||||
typedef T key_type;
|
||||
@@ -54,9 +52,15 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef boost::unordered::detail::set<A, T, H, P> types;
|
||||
typedef typename types::allocator value_allocator;
|
||||
typedef typename types::traits allocator_traits;
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef boost::unordered::detail::set<value_allocator, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
public:
|
||||
@@ -115,17 +119,10 @@ namespace unordered
|
||||
|
||||
unordered_set(unordered_set const&, allocator_type const&);
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_set(BOOST_RV_REF(unordered_set) other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#elif !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_set(unordered_set&& other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_set(unordered_set&&, allocator_type const&);
|
||||
@@ -146,7 +143,6 @@ namespace unordered
|
||||
|
||||
// Assign
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_set& operator=(BOOST_COPY_ASSIGN_REF(unordered_set) x)
|
||||
{
|
||||
table_.assign(x.table_);
|
||||
@@ -158,21 +154,6 @@ namespace unordered
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
unordered_set& operator=(unordered_set const& x)
|
||||
{
|
||||
table_.assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_set& operator=(unordered_set&& x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_set& operator=(std::initializer_list<value_type>);
|
||||
@@ -231,115 +212,20 @@ namespace unordered
|
||||
|
||||
// emplace
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace(Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return table_.emplace(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator, Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...).first;
|
||||
return iterator(table_.emplace(std::forward<Args>(args)...).first);
|
||||
}
|
||||
#else
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
// 0 argument emplace requires special treatment in case
|
||||
// the container is instantiated with a value type that
|
||||
// doesn't have a default constructor.
|
||||
|
||||
std::pair<iterator, bool> emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type())
|
||||
{
|
||||
return this->emplace(boost::move(v));
|
||||
}
|
||||
|
||||
iterator emplace_hint(const_iterator hint,
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type()
|
||||
)
|
||||
{
|
||||
return this->emplace_hint(hint, boost::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
).first;
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
).first;
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
).first;
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
@@ -363,18 +249,39 @@ namespace unordered
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
return iterator(table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)).first; \
|
||||
)).first); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
std::pair<iterator, bool> emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type())
|
||||
{
|
||||
return this->emplace(boost::move(v));
|
||||
}
|
||||
|
||||
iterator emplace_hint(const_iterator hint,
|
||||
boost::unordered::detail::empty_emplace
|
||||
= boost::unordered::detail::empty_emplace(),
|
||||
value_type v = value_type()
|
||||
)
|
||||
{
|
||||
return iterator(this->emplace_hint(hint, boost::move(v)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool> insert(value_type const& x)
|
||||
@@ -511,9 +418,7 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
class unordered_multiset
|
||||
{
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
BOOST_COPYABLE_AND_MOVABLE(unordered_multiset)
|
||||
#endif
|
||||
public:
|
||||
|
||||
typedef T key_type;
|
||||
@@ -524,9 +429,15 @@ namespace unordered
|
||||
|
||||
private:
|
||||
|
||||
typedef boost::unordered::detail::multiset<A, T, H, P> types;
|
||||
typedef typename types::allocator value_allocator;
|
||||
typedef typename types::traits allocator_traits;
|
||||
typedef typename boost::unordered::detail::rebind_wrap<
|
||||
allocator_type, value_type>::type
|
||||
value_allocator;
|
||||
|
||||
typedef boost::unordered::detail::allocator_traits<value_allocator>
|
||||
allocator_traits;
|
||||
|
||||
typedef boost::unordered::detail::multiset<value_allocator, H, P>
|
||||
types;
|
||||
typedef typename types::table table;
|
||||
|
||||
public:
|
||||
@@ -585,17 +496,10 @@ namespace unordered
|
||||
|
||||
unordered_multiset(unordered_multiset const&, allocator_type const&);
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_multiset(BOOST_RV_REF(unordered_multiset) other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#elif !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multiset(unordered_multiset&& other)
|
||||
: table_(other.table_, boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multiset(unordered_multiset&&, allocator_type const&);
|
||||
@@ -616,7 +520,6 @@ namespace unordered
|
||||
|
||||
// Assign
|
||||
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE)
|
||||
unordered_multiset& operator=(
|
||||
BOOST_COPY_ASSIGN_REF(unordered_multiset) x)
|
||||
{
|
||||
@@ -629,21 +532,6 @@ namespace unordered
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
unordered_multiset& operator=(unordered_multiset const& x)
|
||||
{
|
||||
table_.assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multiset& operator=(unordered_multiset&& x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
unordered_multiset& operator=(std::initializer_list<value_type>);
|
||||
@@ -702,25 +590,56 @@ namespace unordered
|
||||
|
||||
// emplace
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template <class... Args>
|
||||
iterator emplace(Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return iterator(table_.emplace(std::forward<Args>(args)...));
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator, Args&&... args)
|
||||
{
|
||||
return table_.emplace(boost::forward<Args>(args)...);
|
||||
return iterator(table_.emplace(std::forward<Args>(args)...));
|
||||
}
|
||||
#else
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
> \
|
||||
iterator emplace( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
))); \
|
||||
} \
|
||||
\
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
> \
|
||||
iterator emplace_hint( \
|
||||
const_iterator, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return iterator(table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
))); \
|
||||
}
|
||||
|
||||
// 0 argument emplace requires special treatment in case
|
||||
// the container is instantiated with a value type that
|
||||
// doesn't have a default constructor.
|
||||
BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
|
||||
#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100))
|
||||
|
||||
iterator emplace(
|
||||
boost::unordered::detail::empty_emplace
|
||||
@@ -741,111 +660,6 @@ namespace unordered
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace(
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
);
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace_hint(const_iterator,
|
||||
BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1,
|
||||
BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace(
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
boost::forward<A0>(a0),
|
||||
boost::forward<A1>(a1),
|
||||
boost::forward<A2>(a2))
|
||||
);
|
||||
}
|
||||
|
||||
#define BOOST_UNORDERED_EMPLACE(z, n, _) \
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
> \
|
||||
iterator emplace( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)); \
|
||||
} \
|
||||
\
|
||||
template < \
|
||||
BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \
|
||||
> \
|
||||
iterator emplace_hint( \
|
||||
const_iterator, \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
|
||||
) \
|
||||
{ \
|
||||
return table_.emplace( \
|
||||
boost::unordered::detail::create_emplace_args( \
|
||||
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
|
||||
a) \
|
||||
)); \
|
||||
}
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT,
|
||||
BOOST_UNORDERED_EMPLACE, _)
|
||||
|
||||
#undef BOOST_UNORDERED_EMPLACE
|
||||
|
||||
#endif
|
||||
|
||||
iterator insert(value_type const& x)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace test
|
||||
it = x1.begin(), end = x1.end();
|
||||
BOOST_DEDUCED_TYPENAME X::size_type size = 0;
|
||||
while(it != end) {
|
||||
// First test that the current key has not occurred before, required
|
||||
// First test that the current key has not occured before, required
|
||||
// to test either that keys are unique or that equivalent keys are
|
||||
// adjacent. (6.3.1/6)
|
||||
key_type key = get_key<X>(*it);
|
||||
|
||||
@@ -168,10 +168,10 @@ namespace test
|
||||
new(p) T(t);
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<typename... Args> void construct(T* p, Args&&... args) {
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
new(p) T(boost::forward<Args>(args)...);
|
||||
new(p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -357,11 +357,11 @@ namespace exception
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
UNORDERED_SCOPE(allocator::construct(pointer, Args&&...)) {
|
||||
UNORDERED_EPOINT("Mock allocator construct function.");
|
||||
new(p) T(boost::forward<Args>(args)...);
|
||||
new(p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ namespace minimal
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef void_ptr void_pointer;
|
||||
typedef void_const_ptr const_void_pointer;
|
||||
typedef void_const_ptr void_const_pointer;
|
||||
typedef ptr<T> pointer;
|
||||
typedef const_ptr<T> const_pointer;
|
||||
typedef T& reference;
|
||||
@@ -367,9 +367,9 @@ namespace minimal
|
||||
|
||||
void construct(T* p, T const& t) { new((void*)p) T(t); }
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
new((void*)p) T(boost::forward<Args>(args)...);
|
||||
new((void*)p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -439,9 +439,9 @@ namespace minimal
|
||||
|
||||
void construct(T* p, T const& t) { new((void*)p) T(t); }
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
new((void*)p) T(boost::forward<Args>(args)...);
|
||||
new((void*)p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -259,10 +259,10 @@ namespace test
|
||||
new(p) T(t);
|
||||
}
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
template<class... Args> void construct(T* p, Args&&... args) {
|
||||
detail::tracker.track_construct((void*) p, sizeof(T), tag_);
|
||||
new(p) T(boost::forward<Args>(args)...);
|
||||
new(p) T(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,15 +9,13 @@ project unordered-test/unordered
|
||||
: requirements
|
||||
<warnings>all
|
||||
<toolset>intel:<warnings>on
|
||||
# Would be nice to define -Wundef, but I'm getting warnings from
|
||||
# Boost.Preprocessor on trunk.
|
||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long"
|
||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
|
||||
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
|
||||
#<toolset>gcc:<define>_GLIBCXX_DEBUG
|
||||
#<toolset>darwin:<define>_GLIBCXX_DEBUG
|
||||
#<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>darwin:<warnings-as-errors>on
|
||||
#<toolset>gcc:<warnings-as-errors>on
|
||||
#<toolset>darwin:<warnings-as-errors>on
|
||||
;
|
||||
|
||||
test-suite unordered
|
||||
@@ -52,20 +50,4 @@ test-suite unordered
|
||||
[ run equality_tests.cpp ]
|
||||
[ run equality_deprecated.cpp ]
|
||||
[ run swap_tests.cpp ]
|
||||
|
||||
[ run compile_set.cpp : :
|
||||
: <define>BOOST_UNORDERED_USE_MOVE
|
||||
: bmove_compile_set ]
|
||||
[ run compile_map.cpp : :
|
||||
: <define>BOOST_UNORDERED_USE_MOVE
|
||||
: bmove_compile_map ]
|
||||
[ run copy_tests.cpp : :
|
||||
: <define>BOOST_UNORDERED_USE_MOVE
|
||||
: bmove_copy ]
|
||||
[ run move_tests.cpp : :
|
||||
: <define>BOOST_UNORDERED_USE_MOVE
|
||||
: bmove_move ]
|
||||
[ run assign_tests.cpp : :
|
||||
: <define>BOOST_UNORDERED_USE_MOVE
|
||||
: bmove_assign ]
|
||||
;
|
||||
|
||||
@@ -90,12 +90,7 @@ void test_empty_allocator()
|
||||
{
|
||||
typedef empty_allocator<int> allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::size_type,
|
||||
std::make_unsigned<std::ptrdiff_t>::type>));
|
||||
#else
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::size_type, std::size_t>));
|
||||
#endif
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::difference_type, std::ptrdiff_t>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::pointer, int*>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::const_pointer, int const*>));
|
||||
@@ -128,12 +123,7 @@ void test_allocator1()
|
||||
{
|
||||
typedef allocator1<int> allocator;
|
||||
typedef boost::unordered::detail::allocator_traits<allocator> traits;
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type,
|
||||
std::make_unsigned<std::ptrdiff_t>::type>));
|
||||
#else
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::size_type, std::size_t>));
|
||||
#endif
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::difference_type, std::ptrdiff_t>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::pointer, int*>));
|
||||
BOOST_MPL_ASSERT((boost::is_same<traits::const_pointer, int const*>));
|
||||
@@ -196,20 +186,6 @@ struct ptr
|
||||
T& operator*() const { return *value_; }
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ptr<void>
|
||||
{
|
||||
void* value_;
|
||||
ptr(void* v) : value_(v) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ptr<const void>
|
||||
{
|
||||
void const* value_;
|
||||
ptr(void const* v) : value_(v) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct allocator3
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/utility/swap.hpp>
|
||||
#include "../helpers/check_return_type.hpp"
|
||||
|
||||
typedef long double comparison_type;
|
||||
|
||||
@@ -51,13 +51,7 @@ void test_simple_allocator()
|
||||
//BOOST_MPL_ASSERT((boost::is_same<typename traits::const_void_pointer, void const*>));
|
||||
|
||||
BOOST_MPL_ASSERT((boost::is_same<typename traits::difference_type, std::ptrdiff_t>));
|
||||
|
||||
#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS
|
||||
BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type,
|
||||
std::make_unsigned<std::ptrdiff_t>::type>));
|
||||
#else
|
||||
BOOST_MPL_ASSERT((boost::is_same<typename traits::size_type, std::size_t>));
|
||||
#endif
|
||||
|
||||
BOOST_TEST(!traits::propagate_on_container_copy_assignment::value);
|
||||
BOOST_TEST(!traits::propagate_on_container_move_assignment::value);
|
||||
|
||||
@@ -22,11 +22,6 @@
|
||||
namespace move_tests
|
||||
{
|
||||
test::seed_t seed(98624);
|
||||
#if defined(BOOST_UNORDERED_USE_MOVE) || !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#define BOOST_UNORDERED_TEST_MOVING 1
|
||||
#else
|
||||
#define BOOST_UNORDERED_TEST_MOVING 0
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
T empty(T*) {
|
||||
@@ -100,7 +95,7 @@ namespace move_tests
|
||||
test::object_count count;
|
||||
T y;
|
||||
y = create(v, count);
|
||||
#if BOOST_UNORDERED_TEST_MOVING && defined(BOOST_HAS_NRVO)
|
||||
#if defined(BOOST_HAS_NRVO)
|
||||
BOOST_TEST(count == test::global_object_count);
|
||||
#endif
|
||||
test::check_container(y, v);
|
||||
@@ -200,10 +195,7 @@ namespace move_tests
|
||||
BOOST_TEST(y.max_load_factor() == 2.0);
|
||||
|
||||
#if defined(BOOST_HAS_NRVO)
|
||||
if (BOOST_UNORDERED_TEST_MOVING ?
|
||||
(bool) allocator_type::is_propagate_on_move :
|
||||
(bool) allocator_type::is_propagate_on_assign)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(test::equivalent(y.get_allocator(), al2));
|
||||
}
|
||||
else {
|
||||
@@ -218,9 +210,7 @@ namespace move_tests
|
||||
T y(0, hf, eq, al1);
|
||||
y = create(v, count, hf, eq, al2, 0.5);
|
||||
#if defined(BOOST_HAS_NRVO)
|
||||
if (BOOST_UNORDERED_TEST_MOVING &&
|
||||
allocator_type::is_propagate_on_move)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(count == test::global_object_count);
|
||||
}
|
||||
#endif
|
||||
@@ -229,10 +219,7 @@ namespace move_tests
|
||||
BOOST_TEST(y.max_load_factor() == 0.5);
|
||||
|
||||
#if defined(BOOST_HAS_NRVO)
|
||||
if (BOOST_UNORDERED_TEST_MOVING ?
|
||||
(bool) allocator_type::is_propagate_on_move :
|
||||
(bool) allocator_type::is_propagate_on_assign)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(test::equivalent(y.get_allocator(), al2));
|
||||
}
|
||||
else {
|
||||
@@ -253,19 +240,14 @@ namespace move_tests
|
||||
|
||||
test::object_count count = test::global_object_count;
|
||||
y = boost::move(x);
|
||||
if (BOOST_UNORDERED_TEST_MOVING &&
|
||||
allocator_type::is_propagate_on_move)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(count == test::global_object_count);
|
||||
}
|
||||
test::check_container(y, v);
|
||||
test::check_equivalent_keys(y);
|
||||
BOOST_TEST(y.max_load_factor() == 0.25);
|
||||
|
||||
if (BOOST_UNORDERED_TEST_MOVING ?
|
||||
(bool) allocator_type::is_propagate_on_move :
|
||||
(bool) allocator_type::is_propagate_on_assign)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(test::equivalent(y.get_allocator(), al2));
|
||||
}
|
||||
else {
|
||||
@@ -290,9 +272,7 @@ namespace move_tests
|
||||
|
||||
test::object_count count2 = test::global_object_count;
|
||||
|
||||
if (BOOST_UNORDERED_TEST_MOVING &&
|
||||
allocator_type::is_propagate_on_move)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(count1.instances ==
|
||||
test::global_object_count.instances);
|
||||
BOOST_TEST(count2.constructions ==
|
||||
@@ -303,10 +283,7 @@ namespace move_tests
|
||||
test::check_equivalent_keys(y);
|
||||
BOOST_TEST(y.max_load_factor() == 0.5);
|
||||
|
||||
if (BOOST_UNORDERED_TEST_MOVING ?
|
||||
(bool) allocator_type::is_propagate_on_move :
|
||||
(bool) allocator_type::is_propagate_on_assign)
|
||||
{
|
||||
if (allocator_type::is_propagate_on_move) {
|
||||
BOOST_TEST(test::equivalent(y.get_allocator(), al2));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -9,23 +9,6 @@
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include "../helpers/test.hpp"
|
||||
|
||||
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
|
||||
# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
|
||||
# elif defined(_LIBCPP_VERSION)
|
||||
# define BOOST_UNORDERED_VARIADIC_MOVE
|
||||
# elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20090804
|
||||
# define BOOST_UNORDERED_VARIADIC_MOVE
|
||||
# endif
|
||||
# elif defined(__STL_CONFIG_H)
|
||||
# elif defined(__MSL_CPP__)
|
||||
# elif defined(__IBMCPP__)
|
||||
# elif defined(MSIPL_COMPILE_H)
|
||||
# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace unnecessary_copy_tests
|
||||
{
|
||||
struct count_copies
|
||||
@@ -260,7 +243,9 @@ namespace unnecessary_copy_tests
|
||||
// the existing element.
|
||||
reset();
|
||||
x.emplace();
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
COPY_COUNT(1); MOVE_COUNT(0);
|
||||
#elif !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
// source_cost doesn't make much sense here, but it seems to fit.
|
||||
COPY_COUNT(1); MOVE_COUNT(source_cost);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user