Remove BOOST_RV_REF

This commit is contained in:
Christian Mazakas
2023-08-30 12:06:44 -07:00
parent 3bd7e93ac6
commit 4cd1827104
9 changed files with 72 additions and 163 deletions

View File

@ -569,7 +569,7 @@ namespace boost {
~grouped_bucket_array() { this->deallocate(); }
grouped_bucket_array(BOOST_RV_REF(grouped_bucket_array) other) noexcept
grouped_bucket_array(grouped_bucket_array&& other) noexcept
: empty_value<node_allocator_type>(
empty_init_t(), other.get_node_allocator()),
size_index_(other.size_index_),
@ -583,8 +583,7 @@ namespace boost {
other.groups = group_pointer();
}
grouped_bucket_array& operator=(
BOOST_RV_REF(grouped_bucket_array) other) noexcept
grouped_bucket_array& operator=(grouped_bucket_array&& other) noexcept
{
BOOST_ASSERT(
this->get_node_allocator() == other.get_node_allocator());

View File

@ -440,7 +440,7 @@ namespace boost {
public:
optional() noexcept : has_value_(false) {}
optional(BOOST_RV_REF(optional<T>) x) : has_value_(false)
optional(optional<T>&& x) : has_value_(false)
{
if (x.has_value_) {
move(x);
@ -452,7 +452,7 @@ namespace boost {
new (value_.value_ptr()) T(x);
}
optional& operator=(BOOST_RV_REF(optional<T>) x)
optional& operator=(optional<T>&& x)
{
destroy();
if (x.has_value_) {
@ -1106,34 +1106,6 @@ namespace boost {
}
};
////////////////////////////////////////////////////////////////////////////
// rvalue parameters when type can't be a BOOST_RV_REF(T) parameter
// e.g. for int
#if !defined(BOOST_NO_CXX11_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::conditional<boost::is_class<T>::value,
boost::unordered::detail::rv_ref_impl<T>,
please_ignore_this_overload>::type
{
};
#define BOOST_UNORDERED_RV_REF(T) \
typename boost::unordered::detail::rv_ref<T>::type
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable : 4127) // conditional expression is constant
@ -2983,10 +2955,7 @@ namespace boost {
static key_type const& extract(value_type const& v) { return v; }
static key_type const& extract(BOOST_UNORDERED_RV_REF(value_type) v)
{
return v;
}
static key_type const& extract(value_type&& v) { return v; }
static no_key extract() { return no_key(); }

View File

@ -97,21 +97,18 @@ namespace boost {
unordered_map(unordered_map const&);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_map(BOOST_RV_REF(unordered_map) other)
unordered_map(unordered_map&& other)
noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag())
{
// The move is done in table_
}
#endif
explicit unordered_map(allocator_type const&);
unordered_map(unordered_map const&, allocator_type const&);
unordered_map(BOOST_RV_REF(unordered_map), allocator_type const&);
unordered_map(unordered_map&&, allocator_type const&);
unordered_map(std::initializer_list<value_type>,
size_type = boost::unordered::detail::default_bucket_count,
@ -146,29 +143,12 @@ namespace boost {
// Assign
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_map& operator=(BOOST_COPY_ASSIGN_REF(unordered_map) x)
{
table_.assign(x.table_, std::true_type());
return *this;
}
unordered_map& operator=(BOOST_RV_REF(unordered_map) x)
noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value)
{
table_.move_assign(x.table_, std::true_type());
return *this;
}
#else
unordered_map& operator=(unordered_map const& x)
{
table_.assign(x.table_, std::true_type());
return *this;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_map& operator=(unordered_map&& x)
noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&&
@ -177,8 +157,6 @@ namespace boost {
table_.move_assign(x.table_, std::true_type());
return *this;
}
#endif
#endif
unordered_map& operator=(std::initializer_list<value_type>);
@ -337,16 +315,15 @@ namespace boost {
return this->emplace(x);
}
std::pair<iterator, bool> insert(BOOST_RV_REF(value_type) x)
std::pair<iterator, bool> insert(value_type&& x)
{
return this->emplace(std::move(x));
}
template <class P2>
typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>,
typename boost::enable_if<boost::is_constructible<value_type, P2&&>,
std::pair<iterator, bool> >::type
insert(BOOST_RV_REF(P2) obj)
insert(P2&& obj)
{
return this->emplace(std::forward<P2>(obj));
}
@ -356,15 +333,15 @@ namespace boost {
return this->emplace_hint(hint, x);
}
iterator insert(const_iterator hint, BOOST_RV_REF(value_type) x)
iterator insert(const_iterator hint, value_type&& x)
{
return this->emplace_hint(hint, std::move(x));
}
template <class P2>
typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>, iterator>::type
insert(const_iterator hint, BOOST_RV_REF(P2) obj)
typename boost::enable_if<boost::is_constructible<value_type, P2&&>,
iterator>::type
insert(const_iterator hint, P2&& obj)
{
return this->emplace_hint(hint, std::forward<P2>(obj));
}
@ -396,14 +373,14 @@ namespace boost {
table_.node_alloc());
}
insert_return_type insert(BOOST_RV_REF(node_type) np)
insert_return_type insert(node_type&& np)
{
insert_return_type result;
table_.move_insert_node_type_unique((node_type&)np, result);
return result;
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
iterator insert(const_iterator hint, node_type&& np)
{
return table_.move_insert_node_type_with_hint_unique(hint, np);
}
@ -427,7 +404,7 @@ namespace boost {
template <class... Args>
std::pair<iterator, bool> try_emplace(
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args)
key_type&& k, BOOST_FWD_REF(Args)... args)
{
return table_.try_emplace_unique(
std::move(k), std::forward<Args>(args)...);
@ -452,8 +429,8 @@ namespace boost {
}
template <class... Args>
iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k,
BOOST_FWD_REF(Args)... args)
iterator try_emplace(
const_iterator hint, key_type&& k, BOOST_FWD_REF(Args)... args)
{
return table_.try_emplace_hint_unique(
hint, std::move(k), std::forward<Args>(args)...);
@ -478,7 +455,7 @@ namespace boost {
template <class M>
std::pair<iterator, bool> insert_or_assign(
BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
key_type&& k, BOOST_FWD_REF(M) obj)
{
return table_.insert_or_assign_unique(
std::move(k), std::forward<M>(obj));
@ -502,7 +479,7 @@ namespace boost {
template <class M>
iterator insert_or_assign(
const_iterator, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj)
const_iterator, key_type&& k, BOOST_FWD_REF(M) obj)
{
return table_
.insert_or_assign_unique(std::move(k), std::forward<M>(obj))
@ -653,7 +630,7 @@ namespace boost {
}
mapped_type& operator[](const key_type&);
mapped_type& operator[](BOOST_RV_REF(key_type));
mapped_type& operator[](key_type&&);
template <class Key>
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
@ -884,22 +861,18 @@ namespace boost {
unordered_multimap(unordered_multimap const&);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multimap(BOOST_RV_REF(unordered_multimap) other)
unordered_multimap(unordered_multimap&& other)
noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag())
{
// The move is done in table_
}
#endif
explicit unordered_multimap(allocator_type const&);
unordered_multimap(unordered_multimap const&, allocator_type const&);
unordered_multimap(
BOOST_RV_REF(unordered_multimap), allocator_type const&);
unordered_multimap(unordered_multimap&&, allocator_type const&);
unordered_multimap(std::initializer_list<value_type>,
size_type = boost::unordered::detail::default_bucket_count,
@ -1008,15 +981,12 @@ namespace boost {
iterator insert(value_type const& x) { return this->emplace(x); }
iterator insert(BOOST_RV_REF(value_type) x)
{
return this->emplace(std::move(x));
}
iterator insert(value_type&& x) { return this->emplace(std::move(x)); }
template <class P2>
typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>, iterator>::type
insert(BOOST_RV_REF(P2) obj)
typename boost::enable_if<boost::is_constructible<value_type, P2&&>,
iterator>::type
insert(P2&& obj)
{
return this->emplace(std::forward<P2>(obj));
}
@ -1026,15 +996,15 @@ namespace boost {
return this->emplace_hint(hint, x);
}
iterator insert(const_iterator hint, BOOST_RV_REF(value_type) x)
iterator insert(const_iterator hint, value_type&& x)
{
return this->emplace_hint(hint, std::move(x));
}
template <class P2>
typename boost::enable_if<
boost::is_constructible<value_type, BOOST_RV_REF(P2)>, iterator>::type
insert(const_iterator hint, BOOST_RV_REF(P2) obj)
typename boost::enable_if<boost::is_constructible<value_type, P2&&>,
iterator>::type
insert(const_iterator hint, P2&& obj)
{
return this->emplace_hint(hint, std::forward<P2>(obj));
}
@ -1065,12 +1035,12 @@ namespace boost {
return node_type(table_.extract_by_key_impl(k), table_.node_alloc());
}
iterator insert(BOOST_RV_REF(node_type) np)
iterator insert(node_type&& np)
{
return table_.move_insert_node_type_equiv(np);
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
iterator insert(const_iterator hint, node_type&& np)
{
return table_.move_insert_node_type_with_hint_equiv(hint, np);
}
@ -1423,7 +1393,7 @@ namespace boost {
template <class K, class T, class H, class P, class A>
unordered_map<K, T, H, P, A>::unordered_map(
BOOST_RV_REF(unordered_map) other, allocator_type const& a)
unordered_map&& other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
table_.move_construct_buckets(other.table_);
@ -1732,7 +1702,7 @@ namespace boost {
template <class K, class T, class H, class P, class A>
typename unordered_map<K, T, H, P, A>::mapped_type&
unordered_map<K, T, H, P, A>::operator[](BOOST_RV_REF(key_type) k)
unordered_map<K, T, H, P, A>::operator[](key_type&& k)
{
return table_.try_emplace_unique(std::move(k)).first->second;
}
@ -1955,7 +1925,7 @@ namespace boost {
template <class K, class T, class H, class P, class A>
unordered_multimap<K, T, H, P, A>::unordered_multimap(
BOOST_RV_REF(unordered_multimap) other, allocator_type const& a)
unordered_multimap&& other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
table_.move_construct_buckets(other.table_);
@ -2387,14 +2357,14 @@ namespace boost {
}
}
node_handle_map(BOOST_RV_REF(node_handle_map) n) noexcept
node_handle_map(node_handle_map&& n) noexcept
: ptr_(n.ptr_),
alloc_(std::move(n.alloc_))
{
n.ptr_ = node_pointer();
}
node_handle_map& operator=(BOOST_RV_REF(node_handle_map) n)
node_handle_map& operator=(node_handle_map&& n)
{
BOOST_ASSERT(!alloc_.has_value() ||
boost::allocator_propagate_on_container_move_assignment<
@ -2479,14 +2449,14 @@ namespace boost {
insert_return_type_map() : position(), inserted(false), node() {}
insert_return_type_map(BOOST_RV_REF(insert_return_type_map) x) noexcept
insert_return_type_map(insert_return_type_map&& x) noexcept
: position(x.position),
inserted(x.inserted),
node(std::move(x.node))
{
}
insert_return_type_map& operator=(BOOST_RV_REF(insert_return_type_map) x)
insert_return_type_map& operator=(insert_return_type_map&& x)
{
inserted = x.inserted;
position = x.position;

View File

@ -95,21 +95,18 @@ namespace boost {
unordered_set(unordered_set const&);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_set(BOOST_RV_REF(unordered_set) other)
unordered_set(unordered_set&& other)
noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag())
{
// The move is done in table_
}
#endif
explicit unordered_set(allocator_type const&);
unordered_set(unordered_set const&, allocator_type const&);
unordered_set(BOOST_RV_REF(unordered_set), allocator_type const&);
unordered_set(unordered_set&&, allocator_type const&);
unordered_set(std::initializer_list<value_type>,
size_type = boost::unordered::detail::default_bucket_count,
@ -144,29 +141,12 @@ namespace boost {
// Assign
#if defined(BOOST_UNORDERED_USE_MOVE)
unordered_set& operator=(BOOST_COPY_ASSIGN_REF(unordered_set) x)
{
table_.assign(x.table_, std::true_type());
return *this;
}
unordered_set& operator=(BOOST_RV_REF(unordered_set) x)
noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&&
boost::is_nothrow_move_assignable<P>::value)
{
table_.move_assign(x.table_, std::true_type());
return *this;
}
#else
unordered_set& operator=(unordered_set const& x)
{
table_.assign(x.table_, std::true_type());
return *this;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_set& operator=(unordered_set&& x)
noexcept(value_allocator_traits::is_always_equal::value&&
boost::is_nothrow_move_assignable<H>::value&&
@ -175,8 +155,6 @@ namespace boost {
table_.move_assign(x.table_, std::true_type());
return *this;
}
#endif
#endif
unordered_set& operator=(std::initializer_list<value_type>);
@ -289,7 +267,7 @@ namespace boost {
return this->emplace(x);
}
std::pair<iterator, bool> insert(BOOST_UNORDERED_RV_REF(value_type) x)
std::pair<iterator, bool> insert(value_type&& x)
{
return this->emplace(std::move(x));
}
@ -308,7 +286,7 @@ namespace boost {
return this->emplace_hint(hint, x);
}
iterator insert(const_iterator hint, BOOST_UNORDERED_RV_REF(value_type) x)
iterator insert(const_iterator hint, value_type&& x)
{
return this->emplace_hint(hint, std::move(x));
}
@ -348,14 +326,14 @@ namespace boost {
return node_type(table_.extract_by_key_impl(k), table_.node_alloc());
}
insert_return_type insert(BOOST_RV_REF(node_type) np)
insert_return_type insert(node_type&& np)
{
insert_return_type result;
table_.move_insert_node_type_unique(np, result);
return result;
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
iterator insert(const_iterator hint, node_type&& np)
{
return table_.move_insert_node_type_with_hint_unique(hint, np);
}
@ -677,22 +655,18 @@ namespace boost {
unordered_multiset(unordered_multiset const&);
#if defined(BOOST_UNORDERED_USE_MOVE) || \
!defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
unordered_multiset(BOOST_RV_REF(unordered_multiset) other)
unordered_multiset(unordered_multiset&& other)
noexcept(table::nothrow_move_constructible)
: table_(other.table_, boost::unordered::detail::move_tag())
{
// The move is done in table_
}
#endif
explicit unordered_multiset(allocator_type const&);
unordered_multiset(unordered_multiset const&, allocator_type const&);
unordered_multiset(
BOOST_RV_REF(unordered_multiset), allocator_type const&);
unordered_multiset(unordered_multiset&&, allocator_type const&);
unordered_multiset(std::initializer_list<value_type>,
size_type = boost::unordered::detail::default_bucket_count,
@ -850,17 +824,14 @@ namespace boost {
iterator insert(value_type const& x) { return this->emplace(x); }
iterator insert(BOOST_UNORDERED_RV_REF(value_type) x)
{
return this->emplace(std::move(x));
}
iterator insert(value_type&& x) { return this->emplace(std::move(x)); }
iterator insert(const_iterator hint, value_type const& x)
{
return this->emplace_hint(hint, x);
}
iterator insert(const_iterator hint, BOOST_UNORDERED_RV_REF(value_type) x)
iterator insert(const_iterator hint, value_type&& x)
{
return this->emplace_hint(hint, std::move(x));
}
@ -891,12 +862,12 @@ namespace boost {
return node_type(table_.extract_by_key_impl(k), table_.node_alloc());
}
iterator insert(BOOST_RV_REF(node_type) np)
iterator insert(node_type&& np)
{
return table_.move_insert_node_type_equiv(np);
}
iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np)
iterator insert(const_iterator hint, node_type&& np)
{
return table_.move_insert_node_type_with_hint_equiv(hint, np);
}
@ -1214,7 +1185,7 @@ namespace boost {
template <class T, class H, class P, class A>
unordered_set<T, H, P, A>::unordered_set(
BOOST_RV_REF(unordered_set) other, allocator_type const& a)
unordered_set&& other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
table_.move_construct_buckets(other.table_);
@ -1616,7 +1587,7 @@ namespace boost {
template <class T, class H, class P, class A>
unordered_multiset<T, H, P, A>::unordered_multiset(
BOOST_RV_REF(unordered_multiset) other, allocator_type const& a)
unordered_multiset&& other, allocator_type const& a)
: table_(other.table_, a, boost::unordered::detail::move_tag())
{
table_.move_construct_buckets(other.table_);
@ -2014,14 +1985,14 @@ namespace boost {
}
}
node_handle_set(BOOST_RV_REF(node_handle_set) n) noexcept
node_handle_set(node_handle_set&& n) noexcept
: ptr_(n.ptr_),
alloc_(std::move(n.alloc_))
{
n.ptr_ = node_pointer();
}
node_handle_set& operator=(BOOST_RV_REF(node_handle_set) n)
node_handle_set& operator=(node_handle_set&& n)
{
BOOST_ASSERT(!alloc_.has_value() ||
value_allocator_traits::
@ -2098,14 +2069,14 @@ namespace boost {
insert_return_type_set() : position(), inserted(false), node() {}
insert_return_type_set(BOOST_RV_REF(insert_return_type_set) x) noexcept
insert_return_type_set(insert_return_type_set&& x) noexcept
: position(x.position),
inserted(x.inserted),
node(std::move(x.node))
{
}
insert_return_type_set& operator=(BOOST_RV_REF(insert_return_type_set) x)
insert_return_type_set& operator=(insert_return_type_set&& x)
{
inserted = x.inserted;
position = x.position;

View File

@ -171,8 +171,8 @@ namespace test {
movable1(constructor_param const&) {}
movable1() {}
explicit movable1(movable_init) {}
movable1(BOOST_RV_REF(movable1)) {}
movable1& operator=(BOOST_RV_REF(movable1)) { return *this; }
movable1(movable1&&) {}
movable1& operator=(movable1&&) { return *this; }
~movable1() {}
void dummy_member() const {}
};

View File

@ -106,7 +106,7 @@ namespace test {
BOOST_TEST(x.tag1_ != -1);
}
movable(BOOST_RV_REF(movable) x)
movable(movable&& x)
: counted_object(x), tag1_(x.tag1_), tag2_(x.tag2_)
{
BOOST_TEST(x.tag1_ != -1);
@ -122,7 +122,7 @@ namespace test {
return *this;
}
movable& operator=(BOOST_RV_REF(movable) x) // Move assignment
movable& operator=(movable&& x) // Move assignment
{
BOOST_TEST(x.tag1_ != -1);
tag1_ = x.tag1_;

View File

@ -701,7 +701,7 @@ namespace insert_tests {
pointer_constructible(int x_) : x(x_) {}
pointer_constructible(pointer_constructible const& p) : x(p.x) {}
pointer_constructible(pointer_constructible* const&) : x(-1) {}
pointer_constructible(BOOST_RV_REF(pointer_constructible*)) : x(-1) {}
pointer_constructible(pointer_constructible*&&) : x(-1) {}
};
struct pointer_constructible_hash

View File

@ -62,7 +62,7 @@ namespace noexcept_tests {
typedef boost::hash<int> base;
public:
hash_nothrow(BOOST_RV_REF(hash_nothrow)) noexcept(nothrow_move_construct)
hash_nothrow(hash_nothrow&&) noexcept(nothrow_move_construct)
{
if (!nothrow_move_construct) {
test_throw("Move Constructor");
@ -76,7 +76,7 @@ namespace noexcept_tests {
test_throw("Assign");
return *this;
}
hash_nothrow& operator=(BOOST_RV_REF(hash_nothrow))
hash_nothrow& operator=(hash_nothrow&&)
noexcept(nothrow_move_assign)
{
if (!nothrow_move_assign) {
@ -110,7 +110,7 @@ namespace noexcept_tests {
typedef boost::hash<int> base;
public:
equal_to_nothrow(BOOST_RV_REF(equal_to_nothrow))
equal_to_nothrow(equal_to_nothrow&&)
noexcept(nothrow_move_construct)
{
if (!nothrow_move_construct) {
@ -125,7 +125,7 @@ namespace noexcept_tests {
test_throw("Assign");
return *this;
}
equal_to_nothrow& operator=(BOOST_RV_REF(equal_to_nothrow))
equal_to_nothrow& operator=(equal_to_nothrow&&)
noexcept(nothrow_move_assign)
{
if (!nothrow_move_assign) {
@ -367,7 +367,7 @@ template <class T> class allocator1
{
BOOST_COPYABLE_AND_MOVABLE(allocator1)
allocator1 operator=(BOOST_COPY_ASSIGN_REF(allocator1));
allocator1 operator=(BOOST_RV_REF(allocator1));
allocator1 operator=(allocator1&&);
public:
typedef T value_type;
@ -403,7 +403,7 @@ public:
template <class U> allocator2(allocator2<U> const&) {}
allocator2& operator=(BOOST_RV_REF(allocator2)) { return *this; }
allocator2& operator=(allocator2&&) { return *this; }
T* allocate(std::size_t n)
{

View File

@ -56,7 +56,7 @@ namespace unnecessary_copy_tests {
trace_op("Copy construct");
}
count_copies(BOOST_RV_REF(count_copies) x) : tag_(x.tag_), id_(++id_count)
count_copies(count_copies&& x) : tag_(x.tag_), id_(++id_count)
{
x.tag_ = -1;
++moves;
@ -72,7 +72,7 @@ namespace unnecessary_copy_tests {
return *this;
}
count_copies& operator=(BOOST_RV_REF(count_copies) p) // Move assignment
count_copies& operator=(count_copies&& p) // Move assignment
{
tag_ = p.tag_;
++moves;