forked from boostorg/unordered
Unordered: Try to fix issues with moving non-class types.
[SVN r74193]
This commit is contained in:
@ -228,6 +228,14 @@ namespace boost { namespace unordered { namespace detail {
|
||||
this->find_node(bucket_index, hash, k));
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
node_ptr emplace(please_ignore_this_overload const&)
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
return this->begin();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
template <class... Args>
|
||||
|
@ -196,6 +196,14 @@ namespace boost { namespace unordered { namespace detail {
|
||||
}
|
||||
|
||||
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
emplace_return emplace(please_ignore_this_overload const&)
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
return emplace_return(this->begin(), false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_UNORDERED_STD_FORWARD_MOVE)
|
||||
|
||||
template<class... Args>
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#if defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
#include <boost/type_traits/is_class.hpp>
|
||||
#endif
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/move/move.hpp>
|
||||
#include <boost/swap.hpp>
|
||||
@ -128,6 +131,36 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
|
||||
#define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T)
|
||||
|
||||
#else
|
||||
|
||||
struct please_ignore_this_overload {
|
||||
typedef please_ignore_this_overload type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct rv_ref_impl {
|
||||
typedef BOOST_RV_REF(T) type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct rv_ref :
|
||||
boost::detail::if_true<
|
||||
boost::is_class<T>::value
|
||||
>::BOOST_NESTED_TEMPLATE then <
|
||||
rv_ref_impl<T>,
|
||||
please_ignore_this_overload
|
||||
>::type
|
||||
{};
|
||||
|
||||
#define BOOST_UNORDERED_RV_REF(T) \
|
||||
typename ::boost::unordered::detail::rv_ref<T>::type
|
||||
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -132,9 +132,7 @@ namespace unordered
|
||||
|
||||
unordered_map(unordered_map const&);
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
unordered_map& operator=(
|
||||
BOOST_RV_REF(unordered_map) x)
|
||||
unordered_map& operator=(BOOST_RV_REF(unordered_map) x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
@ -144,7 +142,6 @@ namespace unordered
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_map(unordered_map&&, allocator_type const&);
|
||||
@ -257,11 +254,10 @@ namespace unordered
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool> insert(value_type const&);
|
||||
iterator insert(const_iterator, value_type const&);
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
std::pair<iterator, bool> insert(BOOST_RV_REF(value_type));
|
||||
iterator insert(const_iterator, value_type const&);
|
||||
iterator insert(const_iterator, BOOST_RV_REF(value_type));
|
||||
#endif
|
||||
|
||||
template <class InputIt> void insert(InputIt, InputIt);
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
@ -481,9 +477,7 @@ namespace unordered
|
||||
|
||||
unordered_multimap(unordered_multimap const&);
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
unordered_multimap& operator=(
|
||||
BOOST_RV_REF(unordered_multimap) x)
|
||||
unordered_multimap& operator=(BOOST_RV_REF(unordered_multimap) x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
@ -493,7 +487,6 @@ namespace unordered
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multimap(unordered_multimap&&, allocator_type const&);
|
||||
@ -606,11 +599,10 @@ namespace unordered
|
||||
#endif
|
||||
|
||||
iterator insert(value_type const&);
|
||||
iterator insert(const_iterator, value_type const&);
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
iterator insert(BOOST_RV_REF(value_type));
|
||||
iterator insert(const_iterator, value_type const&);
|
||||
iterator insert(const_iterator, BOOST_RV_REF(value_type));
|
||||
#endif
|
||||
|
||||
template <class InputIt> void insert(InputIt, InputIt);
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
@ -930,7 +922,6 @@ namespace unordered
|
||||
return iterator(table_.emplace(obj).first);
|
||||
}
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
template <class K, class T, class H, class P, class A>
|
||||
std::pair<typename unordered_map<K,T,H,P,A>::iterator, bool>
|
||||
unordered_map<K,T,H,P,A>::insert(BOOST_RV_REF(value_type) obj)
|
||||
@ -945,7 +936,6 @@ namespace unordered
|
||||
{
|
||||
return iterator(table_.emplace(boost::move(obj)).first);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
@ -1363,7 +1353,6 @@ namespace unordered
|
||||
return iterator(table_.emplace(obj));
|
||||
}
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
template <class K, class T, class H, class P, class A>
|
||||
typename unordered_multimap<K,T,H,P,A>::iterator
|
||||
unordered_multimap<K,T,H,P,A>::insert(BOOST_RV_REF(value_type) obj)
|
||||
@ -1378,7 +1367,6 @@ namespace unordered
|
||||
{
|
||||
return iterator(table_.emplace(boost::move(obj)));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class K, class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
|
@ -131,9 +131,7 @@ namespace unordered
|
||||
|
||||
unordered_set(unordered_set const&);
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
unordered_set& operator=(
|
||||
BOOST_RV_REF(unordered_set) x)
|
||||
unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
@ -143,7 +141,6 @@ namespace unordered
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_set(unordered_set&&, allocator_type const&);
|
||||
@ -254,11 +251,9 @@ namespace unordered
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool> insert(value_type const&);
|
||||
std::pair<iterator, bool> insert(BOOST_UNORDERED_RV_REF(value_type));
|
||||
iterator insert(const_iterator, value_type const&);
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
std::pair<iterator, bool> insert(BOOST_RV_REF(value_type));
|
||||
iterator insert(const_iterator, BOOST_RV_REF(value_type));
|
||||
#endif
|
||||
iterator insert(const_iterator, BOOST_UNORDERED_RV_REF(value_type));
|
||||
template <class InputIt> void insert(InputIt, InputIt);
|
||||
|
||||
#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST)
|
||||
@ -460,9 +455,7 @@ namespace unordered
|
||||
|
||||
unordered_multiset(unordered_multiset const&);
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
unordered_multiset& operator=(
|
||||
BOOST_RV_REF(unordered_multiset) x)
|
||||
unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x)
|
||||
{
|
||||
table_.move_assign(x.table_);
|
||||
return *this;
|
||||
@ -472,7 +465,6 @@ namespace unordered
|
||||
: table_(other.table_, ::boost::unordered::detail::move_tag())
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_RVALUE_REFERENCES)
|
||||
unordered_multiset(unordered_multiset&&, allocator_type const&);
|
||||
@ -583,11 +575,10 @@ namespace unordered
|
||||
#endif
|
||||
|
||||
iterator insert(value_type const&);
|
||||
iterator insert(BOOST_UNORDERED_RV_REF(value_type));
|
||||
iterator insert(const_iterator, value_type const&);
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
iterator insert(BOOST_RV_REF(value_type));
|
||||
iterator insert(const_iterator, BOOST_RV_REF(value_type));
|
||||
#endif
|
||||
iterator insert(const_iterator, BOOST_UNORDERED_RV_REF(value_type));
|
||||
|
||||
template <class InputIt>
|
||||
void insert(InputIt, InputIt);
|
||||
|
||||
@ -895,10 +886,9 @@ namespace unordered
|
||||
return iterator(table_.emplace(obj).first);
|
||||
}
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
template <class T, class H, class P, class A>
|
||||
std::pair<typename unordered_set<T,H,P,A>::iterator, bool>
|
||||
unordered_set<T,H,P,A>::insert(BOOST_RV_REF(value_type) obj)
|
||||
unordered_set<T,H,P,A>::insert(BOOST_UNORDERED_RV_REF(value_type) obj)
|
||||
{
|
||||
return table_.emplace(boost::move(obj));
|
||||
}
|
||||
@ -906,11 +896,10 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_set<T,H,P,A>::iterator
|
||||
unordered_set<T,H,P,A>::insert(const_iterator,
|
||||
BOOST_RV_REF(value_type) obj)
|
||||
BOOST_UNORDERED_RV_REF(value_type) obj)
|
||||
{
|
||||
return iterator(table_.emplace(boost::move(obj)).first);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
@ -1275,10 +1264,9 @@ namespace unordered
|
||||
return iterator(table_.emplace(obj));
|
||||
}
|
||||
|
||||
#if BOOST_UNORDERED_USE_RV_REF
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_multiset<T,H,P,A>::iterator
|
||||
unordered_multiset<T,H,P,A>::insert(BOOST_RV_REF(value_type) obj)
|
||||
unordered_multiset<T,H,P,A>::insert(BOOST_UNORDERED_RV_REF(value_type) obj)
|
||||
{
|
||||
return iterator(table_.emplace(boost::move(obj)));
|
||||
}
|
||||
@ -1286,11 +1274,10 @@ namespace unordered
|
||||
template <class T, class H, class P, class A>
|
||||
typename unordered_multiset<T,H,P,A>::iterator
|
||||
unordered_multiset<T,H,P,A>::insert(const_iterator,
|
||||
BOOST_RV_REF(value_type) obj)
|
||||
BOOST_UNORDERED_RV_REF(value_type) obj)
|
||||
{
|
||||
return iterator(table_.emplace(boost::move(obj)));
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T, class H, class P, class A>
|
||||
template <class InputIt>
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "./compile_tests.hpp"
|
||||
|
||||
// Explicit instantiation to catch compile-time errors
|
||||
/*
|
||||
|
||||
template class boost::unordered_set<
|
||||
int,
|
||||
boost::hash<int>,
|
||||
@ -27,7 +27,7 @@ template class boost::unordered_multiset<
|
||||
boost::hash<int>,
|
||||
std::equal_to<int>,
|
||||
test::minimal::allocator<int> >;
|
||||
*/
|
||||
|
||||
template class boost::unordered_set<
|
||||
test::minimal::assignable,
|
||||
test::minimal::hash<test::minimal::assignable>,
|
||||
|
Reference in New Issue
Block a user