Unordered: Make using Boost.Move optional.

[SVN r76330]
This commit is contained in:
Daniel James
2012-01-06 08:35:51 +00:00
parent ac0a2fe6c9
commit d70fcb8c25
3 changed files with 131 additions and 9 deletions

View File

@@ -41,7 +41,9 @@ 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;
@@ -113,10 +115,17 @@ 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&);
@@ -137,6 +146,7 @@ namespace unordered
// Assign
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_set& operator=(BOOST_COPY_ASSIGN_REF(unordered_set) x)
{
table_.assign(x.table_);
@@ -148,6 +158,21 @@ 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>);
@@ -486,7 +511,9 @@ 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;
@@ -558,10 +585,17 @@ 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&);
@@ -582,6 +616,7 @@ namespace unordered
// Assign
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_multiset& operator=(
BOOST_COPY_ASSIGN_REF(unordered_multiset) x)
{
@@ -594,6 +629,21 @@ 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>);