Unordered: Merge move changes. Fixes #6311.

[SVN r76531]
This commit is contained in:
Daniel James
2012-01-15 20:22:15 +00:00
parent 280b1971b6
commit 63d56953af
12 changed files with 209 additions and 69 deletions

View File

@@ -41,7 +41,9 @@ 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:
@@ -115,10 +117,17 @@ 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&);
@@ -139,6 +148,7 @@ namespace unordered
// Assign
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_map& operator=(BOOST_COPY_ASSIGN_REF(unordered_map) x)
{
table_.assign(x.table_);
@@ -150,6 +160,21 @@ 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>);
@@ -208,17 +233,17 @@ namespace unordered
// emplace
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
template <class... Args>
std::pair<iterator, bool> emplace(Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...);
return table_.emplace(boost::forward<Args>(args)...);
}
template <class... Args>
iterator emplace_hint(const_iterator, Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...).first;
return table_.emplace(boost::forward<Args>(args)...).first;
}
#else
@@ -501,8 +526,9 @@ 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;
@@ -575,10 +601,17 @@ 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&);
@@ -599,6 +632,7 @@ namespace unordered
// Assign
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_multimap& operator=(
BOOST_COPY_ASSIGN_REF(unordered_multimap) x)
{
@@ -611,6 +645,21 @@ 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>);
@@ -669,17 +718,17 @@ namespace unordered
// emplace
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
#if defined(BOOST_UNORDERED_VARIADIC_MOVE)
template <class... Args>
iterator emplace(Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...);
return table_.emplace(boost::forward<Args>(args)...);
}
template <class... Args>
iterator emplace_hint(const_iterator, Args&&... args)
{
return table_.emplace(std::forward<Args>(args)...);
return table_.emplace(boost::forward<Args>(args)...);
}
#else