|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75908 - in branches/release: . boost boost/unordered boost/unordered/detail libs libs/unordered libs/unordered/doc libs/unordered/test/unordered
From: dnljms_at_[hidden]
Date: 2011-12-11 16:39:20
Author: danieljames
Date: 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
New Revision: 75908
URL: http://svn.boost.org/trac/boost/changeset/75908
Log:
Unordered: merge from trunk.
Properties modified:
branches/release/ (props changed)
branches/release/boost/ (props changed)
branches/release/boost/unordered/ (props changed)
branches/release/libs/ (props changed)
branches/release/libs/unordered/ (props changed)
Text files modified:
branches/release/boost/unordered/detail/emplace_args.hpp | 72 ++++++++++
branches/release/boost/unordered/detail/equivalent.hpp | 36 ++--
branches/release/boost/unordered/detail/table.hpp | 6
branches/release/boost/unordered/detail/unique.hpp | 28 ++-
branches/release/boost/unordered/unordered_map.hpp | 280 +++++++++++++++++++++++++++++----------
branches/release/boost/unordered/unordered_set.hpp | 278 +++++++++++++++++++++++++++++----------
branches/release/libs/unordered/doc/changes.qbk | 5
branches/release/libs/unordered/test/unordered/Jamfile.v2 | 6
8 files changed, 531 insertions(+), 180 deletions(-)
Modified: branches/release/boost/unordered/detail/emplace_args.hpp
==============================================================================
--- branches/release/boost/unordered/detail/emplace_args.hpp (original)
+++ branches/release/boost/unordered/detail/emplace_args.hpp 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -173,6 +173,8 @@
//
// 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<>) \
@@ -206,6 +208,49 @@
#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.
@@ -334,7 +379,32 @@
args.a)); \
}
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
+ 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_UNORDERED_CONSTRUCT_IMPL, _)
#undef BOOST_UNORDERED_CONSTRUCT_IMPL
Modified: branches/release/boost/unordered/detail/equivalent.hpp
==============================================================================
--- branches/release/boost/unordered/detail/equivalent.hpp (original)
+++ branches/release/boost/unordered/detail/equivalent.hpp 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -115,20 +115,21 @@
typedef typename pick::link_pointer link_pointer;
};
- template <typename A, typename H, typename P>
+ template <typename A, typename T, typename H, typename P>
struct multiset
{
- typedef boost::unordered::detail::multiset<A, H, P> types;
+ typedef boost::unordered::detail::multiset<A, T, H, P> types;
- typedef A allocator;
+ typedef T value_type;
typedef H hasher;
typedef P key_equal;
+ typedef T key_type;
- typedef boost::unordered::detail::allocator_traits<A> traits;
- typedef typename traits::value_type value_type;
- typedef value_type key_type;
+ typedef typename boost::unordered::detail::rebind_wrap<
+ A, value_type>::type allocator;
- typedef boost::unordered::detail::pick_grouped_node<A, value_type> pick;
+ typedef boost::unordered::detail::allocator_traits<allocator> traits;
+ typedef boost::unordered::detail::pick_grouped_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
@@ -137,20 +138,21 @@
typedef boost::unordered::detail::set_extractor<value_type> extractor;
};
- template <typename A, typename K, typename H, typename P>
+ template <typename A, typename K, typename M, typename H, typename P>
struct multimap
{
- typedef boost::unordered::detail::multimap<A, K, H, P> types;
+ typedef boost::unordered::detail::multimap<A, K, M, H, P> types;
- typedef A allocator;
+ typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K key_type;
- typedef boost::unordered::detail::allocator_traits<A> traits;
- typedef typename traits::value_type value_type;
+ typedef typename boost::unordered::detail::rebind_wrap<
+ A, value_type>::type allocator;
- typedef boost::unordered::detail::pick_grouped_node<A, value_type> pick;
+ typedef boost::unordered::detail::allocator_traits<allocator> traits;
+ typedef boost::unordered::detail::pick_grouped_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
@@ -451,22 +453,22 @@
}
#if defined(BOOST_NO_RVALUE_REFERENCES)
- node_pointer emplace(boost::unordered::detail::emplace_args1<
+ iterator emplace(boost::unordered::detail::emplace_args1<
boost::unordered::detail::please_ignore_this_overload> const&)
{
BOOST_ASSERT(false);
- return this->begin();
+ return iterator();
}
#endif
template <BOOST_UNORDERED_EMPLACE_TEMPLATE>
- node_pointer emplace(BOOST_UNORDERED_EMPLACE_ARGS)
+ iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS)
{
node_constructor a(this->node_alloc());
a.construct_node();
a.construct_value(BOOST_UNORDERED_EMPLACE_FORWARD);
- return emplace_impl(a);
+ return iterator(emplace_impl(a));
}
////////////////////////////////////////////////////////////////////////
Modified: branches/release/boost/unordered/detail/table.hpp
==============================================================================
--- branches/release/boost/unordered/detail/table.hpp (original)
+++ branches/release/boost/unordered/detail/table.hpp 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -174,13 +174,13 @@
}
iterator& operator++() {
- node_ = node_ = static_cast<node_pointer>(node_->next_);
+ node_ = static_cast<node_pointer>(node_->next_);
return *this;
}
iterator operator++(int) {
iterator tmp(node_);
- node_ = node_ = static_cast<node_pointer>(node_->next_);
+ node_ = static_cast<node_pointer>(node_->next_);
return tmp;
}
@@ -242,7 +242,7 @@
c_iterator operator++(int) {
c_iterator tmp(node_);
- node_ = node_ = static_cast<node_pointer>(node_->next_);
+ node_ = static_cast<node_pointer>(node_->next_);
return tmp;
}
Modified: branches/release/boost/unordered/detail/unique.hpp
==============================================================================
--- branches/release/boost/unordered/detail/unique.hpp (original)
+++ branches/release/boost/unordered/detail/unique.hpp 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -111,20 +111,21 @@
typedef typename pick::link_pointer link_pointer;
};
- template <typename A, typename H, typename P>
+ template <typename A, typename T, typename H, typename P>
struct set
{
- typedef boost::unordered::detail::set<A, H, P> types;
+ typedef boost::unordered::detail::set<A, T, H, P> types;
- typedef A allocator;
+ typedef T value_type;
typedef H hasher;
typedef P key_equal;
+ typedef T key_type;
- typedef boost::unordered::detail::allocator_traits<A> traits;
- typedef typename traits::value_type value_type;
- typedef value_type key_type;
+ typedef typename boost::unordered::detail::rebind_wrap<
+ A, value_type>::type allocator;
- typedef boost::unordered::detail::pick_node<A, value_type> pick;
+ typedef boost::unordered::detail::allocator_traits<allocator> traits;
+ typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
@@ -133,20 +134,21 @@
typedef boost::unordered::detail::set_extractor<value_type> extractor;
};
- template <typename A, typename K, typename H, typename P>
+ template <typename A, typename K, typename M, typename H, typename P>
struct map
{
- typedef boost::unordered::detail::map<A, K, H, P> types;
+ typedef boost::unordered::detail::map<A, K, M, H, P> types;
- typedef A allocator;
+ typedef std::pair<K const, M> value_type;
typedef H hasher;
typedef P key_equal;
typedef K key_type;
- typedef boost::unordered::detail::allocator_traits<A> traits;
- typedef typename traits::value_type value_type;
+ typedef typename boost::unordered::detail::rebind_wrap<
+ A, value_type>::type allocator;
- typedef boost::unordered::detail::pick_node<A, value_type> pick;
+ typedef boost::unordered::detail::allocator_traits<allocator> traits;
+ typedef boost::unordered::detail::pick_node<allocator, value_type> pick;
typedef typename pick::node node;
typedef typename pick::bucket bucket;
typedef typename pick::link_pointer link_pointer;
Modified: branches/release/boost/unordered/unordered_map.hpp
==============================================================================
--- branches/release/boost/unordered/unordered_map.hpp (original)
+++ branches/release/boost/unordered/unordered_map.hpp 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -54,15 +54,9 @@
private:
- 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 boost::unordered::detail::map<A, K, T, H, P> types;
+ typedef typename types::allocator value_allocator;
+ typedef typename types::traits allocator_traits;
typedef typename types::table table;
public:
@@ -84,7 +78,7 @@
private:
table table_;
-
+
public:
// constructors
@@ -224,10 +218,105 @@
template <class... Args>
iterator emplace_hint(const_iterator, Args&&... args)
{
- return iterator(table_.emplace(std::forward<Args>(args)...).first);
+ return 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) \
@@ -251,39 +340,18 @@
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return iterator(table_.emplace( \
+ return 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(1, BOOST_UNORDERED_EMPLACE_LIMIT,
+ BOOST_PP_REPEAT_FROM_TO(4, 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)
@@ -446,15 +514,9 @@
private:
- 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 boost::unordered::detail::multimap<A, K, T, H, P> types;
+ typedef typename types::allocator value_allocator;
+ typedef typename types::traits allocator_traits;
typedef typename types::table table;
public:
@@ -611,16 +673,111 @@
template <class... Args>
iterator emplace(Args&&... args)
{
- return iterator(table_.emplace(std::forward<Args>(args)...));
+ return table_.emplace(std::forward<Args>(args)...);
}
template <class... Args>
iterator emplace_hint(const_iterator, Args&&... args)
{
- return iterator(table_.emplace(std::forward<Args>(args)...));
+ return 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) \
@@ -629,11 +786,11 @@
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return iterator(table_.emplace( \
+ return table_.emplace( \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
a) \
- ))); \
+ )); \
} \
\
template < \
@@ -644,39 +801,18 @@
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return iterator(table_.emplace( \
+ return table_.emplace( \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
a) \
- ))); \
+ )); \
}
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
+ BOOST_PP_REPEAT_FROM_TO(4, 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)
Modified: branches/release/boost/unordered/unordered_set.hpp
==============================================================================
--- branches/release/boost/unordered/unordered_set.hpp (original)
+++ branches/release/boost/unordered/unordered_set.hpp 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -52,15 +52,9 @@
private:
- 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 boost::unordered::detail::set<A, T, H, P> types;
+ typedef typename types::allocator value_allocator;
+ typedef typename types::traits allocator_traits;
typedef typename types::table table;
public:
@@ -222,10 +216,105 @@
template <class... Args>
iterator emplace_hint(const_iterator, Args&&... args)
{
- return iterator(table_.emplace(std::forward<Args>(args)...).first);
+ return 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) \
@@ -249,39 +338,18 @@
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return iterator(table_.emplace( \
+ return 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(1, BOOST_UNORDERED_EMPLACE_LIMIT,
+ BOOST_PP_REPEAT_FROM_TO(4, 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)
@@ -429,15 +497,9 @@
private:
- 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 boost::unordered::detail::multiset<A, T, H, P> types;
+ typedef typename types::allocator value_allocator;
+ typedef typename types::traits allocator_traits;
typedef typename types::table table;
public:
@@ -594,16 +656,111 @@
template <class... Args>
iterator emplace(Args&&... args)
{
- return iterator(table_.emplace(std::forward<Args>(args)...));
+ return table_.emplace(std::forward<Args>(args)...);
}
template <class... Args>
iterator emplace_hint(const_iterator, Args&&... args)
{
- return iterator(table_.emplace(std::forward<Args>(args)...));
+ return 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) \
@@ -612,11 +769,11 @@
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return iterator(table_.emplace( \
+ return table_.emplace( \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
a) \
- ))); \
+ )); \
} \
\
template < \
@@ -627,39 +784,18 @@
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \
) \
{ \
- return iterator(table_.emplace( \
+ return table_.emplace( \
boost::unordered::detail::create_emplace_args( \
BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \
a) \
- ))); \
+ )); \
}
- BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT,
+ BOOST_PP_REPEAT_FROM_TO(4, 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 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
iterator insert(value_type const& x)
Modified: branches/release/libs/unordered/doc/changes.qbk
==============================================================================
--- branches/release/libs/unordered/doc/changes.qbk (original)
+++ branches/release/libs/unordered/doc/changes.qbk 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -170,4 +170,9 @@
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]
Modified: branches/release/libs/unordered/test/unordered/Jamfile.v2
==============================================================================
--- branches/release/libs/unordered/test/unordered/Jamfile.v2 (original)
+++ branches/release/libs/unordered/test/unordered/Jamfile.v2 2011-12-11 16:39:18 EST (Sun, 11 Dec 2011)
@@ -9,13 +9,13 @@
: requirements
<warnings>all
<toolset>intel:<warnings>on
- <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
+ <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long"
<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
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk