mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Remove BOOST_FWD_REF
This commit is contained in:
@ -661,7 +661,7 @@ namespace boost {
|
||||
|
||||
template <typename Alloc, typename T, typename... Args>
|
||||
inline void construct_from_args(
|
||||
Alloc& alloc, T* address, BOOST_FWD_REF(Args)... args)
|
||||
Alloc& alloc, T* address, Args&&... args)
|
||||
{
|
||||
boost::allocator_construct(
|
||||
alloc, address, std::forward<Args>(args)...);
|
||||
@ -723,8 +723,8 @@ namespace boost {
|
||||
detect_boost_tuple<A1>::value &&
|
||||
detect_boost_tuple<A2>::value,
|
||||
void>::type
|
||||
construct_from_args(Alloc& alloc, std::pair<A, B>* address,
|
||||
BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
construct_from_args(
|
||||
Alloc& alloc, std::pair<A, B>* address, A0&&, A1&& a1, A2&& a2)
|
||||
{
|
||||
boost::allocator_construct(alloc, address, std::piecewise_construct,
|
||||
to_std_tuple(a1), to_std_tuple(a2));
|
||||
@ -853,7 +853,7 @@ namespace boost {
|
||||
|
||||
template <typename Alloc, typename U>
|
||||
inline typename boost::allocator_pointer<Alloc>::type construct_node(
|
||||
Alloc& alloc, BOOST_FWD_REF(U) x)
|
||||
Alloc& alloc, U&& x)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
@ -872,7 +872,7 @@ namespace boost {
|
||||
|
||||
template <typename Alloc, typename Key>
|
||||
inline typename boost::allocator_pointer<Alloc>::type
|
||||
construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k)
|
||||
construct_node_pair(Alloc& alloc, Key&& k)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
@ -893,8 +893,7 @@ namespace boost {
|
||||
|
||||
template <typename Alloc, typename Key, typename Mapped>
|
||||
inline typename boost::allocator_pointer<Alloc>::type
|
||||
construct_node_pair(
|
||||
Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m)
|
||||
construct_node_pair(Alloc& alloc, Key&& k, Mapped&& m)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
@ -915,8 +914,7 @@ namespace boost {
|
||||
|
||||
template <typename Alloc, typename Key, typename... Args>
|
||||
inline typename boost::allocator_pointer<Alloc>::type
|
||||
construct_node_pair_from_args(
|
||||
Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Args)... args)
|
||||
construct_node_pair_from_args(Alloc& alloc, Key&& k, Args&&... args)
|
||||
{
|
||||
node_constructor<Alloc> a(alloc);
|
||||
a.create_node();
|
||||
@ -938,15 +936,14 @@ namespace boost {
|
||||
|
||||
template <typename T, typename Alloc, typename Key>
|
||||
inline typename boost::allocator_pointer<Alloc>::type
|
||||
construct_node_from_key(T*, Alloc& alloc, BOOST_FWD_REF(Key) k)
|
||||
construct_node_from_key(T*, Alloc& alloc, Key&& k)
|
||||
{
|
||||
return construct_node(alloc, std::forward<Key>(k));
|
||||
}
|
||||
|
||||
template <typename T, typename V, typename Alloc, typename Key>
|
||||
inline typename boost::allocator_pointer<Alloc>::type
|
||||
construct_node_from_key(
|
||||
std::pair<T const, V>*, Alloc& alloc, BOOST_FWD_REF(Key) k)
|
||||
construct_node_from_key(std::pair<T const, V>*, Alloc& alloc, Key&& k)
|
||||
{
|
||||
return construct_node_pair(alloc, std::forward<Key>(k));
|
||||
}
|
||||
@ -2081,8 +2078,7 @@ namespace boost {
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Key>
|
||||
emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k)
|
||||
template <typename Key> emplace_return try_emplace_unique(Key&& k)
|
||||
{
|
||||
std::size_t key_hash = this->hash(k);
|
||||
bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
|
||||
@ -2114,7 +2110,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
template <typename Key>
|
||||
iterator try_emplace_hint_unique(c_iterator hint, BOOST_FWD_REF(Key) k)
|
||||
iterator try_emplace_hint_unique(c_iterator hint, Key&& k)
|
||||
{
|
||||
if (hint.p && this->key_eq()(extractor::extract(*hint), k)) {
|
||||
return iterator(hint.p, hint.itb);
|
||||
@ -2124,7 +2120,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
template <typename Key, typename... Args>
|
||||
emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k, Args&&... args)
|
||||
emplace_return try_emplace_unique(Key&& k, Args&&... args)
|
||||
{
|
||||
std::size_t key_hash = this->hash(k);
|
||||
bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
|
||||
@ -2154,7 +2150,7 @@ namespace boost {
|
||||
|
||||
template <typename Key, typename... Args>
|
||||
iterator try_emplace_hint_unique(
|
||||
c_iterator hint, BOOST_FWD_REF(Key) k, Args&&... args)
|
||||
c_iterator hint, Key&& k, Args&&... args)
|
||||
{
|
||||
if (hint.p && this->key_eq()(hint->first, k)) {
|
||||
return iterator(hint.p, hint.itb);
|
||||
@ -2164,8 +2160,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
template <typename Key, typename M>
|
||||
emplace_return insert_or_assign_unique(
|
||||
BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj)
|
||||
emplace_return insert_or_assign_unique(Key&& k, M&& obj)
|
||||
{
|
||||
std::size_t key_hash = this->hash(k);
|
||||
bucket_iterator itb = buckets_.at(buckets_.position(key_hash));
|
||||
|
@ -198,118 +198,21 @@ namespace boost {
|
||||
|
||||
// emplace
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
|
||||
template <class... Args> std::pair<iterator, bool> emplace(Args&&... args)
|
||||
{
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(std::forward<Args>(args)...),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
|
||||
|
||||
// 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(std::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(std::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(std::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(std::forward<A0>(a0), std::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
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_unique(
|
||||
table::extractor::extract(std::forward<A0>(a0), std::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::forward<A1>(a1), std::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
iterator emplace_hint(const_iterator hint, Args&&... args)
|
||||
{
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(std::forward<Args>(args)...),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
|
||||
|
||||
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, std::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(std::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(std::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace_hint(
|
||||
const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(std::forward<A0>(a0), std::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1, typename A2>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0,
|
||||
BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2)
|
||||
{
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(std::forward<A0>(a0), std::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::forward<A1>(a1), std::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
std::pair<iterator, bool> insert(value_type const& x)
|
||||
{
|
||||
return this->emplace(x);
|
||||
@ -367,7 +270,7 @@ namespace boost {
|
||||
typename boost::enable_if_c<
|
||||
detail::transparent_non_iterable<Key, unordered_map>::value,
|
||||
node_type>::type
|
||||
extract(BOOST_FWD_REF(Key) k)
|
||||
extract(Key&& k)
|
||||
{
|
||||
return node_type(table_.extract_by_key_impl(std::forward<Key>(k)),
|
||||
table_.node_alloc());
|
||||
@ -396,15 +299,13 @@ namespace boost {
|
||||
#endif
|
||||
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type const& k, BOOST_FWD_REF(Args)... args)
|
||||
std::pair<iterator, bool> try_emplace(key_type const& k, Args&&... args)
|
||||
{
|
||||
return table_.try_emplace_unique(k, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> try_emplace(
|
||||
key_type&& k, BOOST_FWD_REF(Args)... args)
|
||||
std::pair<iterator, bool> try_emplace(key_type&& k, Args&&... args)
|
||||
{
|
||||
return table_.try_emplace_unique(
|
||||
std::move(k), std::forward<Args>(args)...);
|
||||
@ -422,15 +323,14 @@ namespace boost {
|
||||
|
||||
template <class... Args>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, key_type const& k, BOOST_FWD_REF(Args)... args)
|
||||
const_iterator hint, key_type const& k, Args&&... args)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, k, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator try_emplace(
|
||||
const_iterator hint, key_type&& k, BOOST_FWD_REF(Args)... args)
|
||||
iterator try_emplace(const_iterator hint, key_type&& k, Args&&... args)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(
|
||||
hint, std::move(k), std::forward<Args>(args)...);
|
||||
@ -447,15 +347,13 @@ namespace boost {
|
||||
}
|
||||
|
||||
template <class M>
|
||||
std::pair<iterator, bool> insert_or_assign(
|
||||
key_type const& k, BOOST_FWD_REF(M) obj)
|
||||
std::pair<iterator, bool> insert_or_assign(key_type const& k, M&& obj)
|
||||
{
|
||||
return table_.insert_or_assign_unique(k, std::forward<M>(obj));
|
||||
}
|
||||
|
||||
template <class M>
|
||||
std::pair<iterator, bool> insert_or_assign(
|
||||
key_type&& k, BOOST_FWD_REF(M) obj)
|
||||
std::pair<iterator, bool> insert_or_assign(key_type&& k, M&& obj)
|
||||
{
|
||||
return table_.insert_or_assign_unique(
|
||||
std::move(k), std::forward<M>(obj));
|
||||
@ -464,22 +362,20 @@ namespace boost {
|
||||
template <class Key, class M>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
std::pair<iterator, bool> >::type
|
||||
insert_or_assign(BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj)
|
||||
insert_or_assign(Key&& k, M&& obj)
|
||||
{
|
||||
return table_.insert_or_assign_unique(
|
||||
std::forward<Key>(k), std::forward<M>(obj));
|
||||
}
|
||||
|
||||
template <class M>
|
||||
iterator insert_or_assign(
|
||||
const_iterator, key_type const& k, BOOST_FWD_REF(M) obj)
|
||||
iterator insert_or_assign(const_iterator, key_type const& k, M&& obj)
|
||||
{
|
||||
return table_.insert_or_assign_unique(k, std::forward<M>(obj)).first;
|
||||
}
|
||||
|
||||
template <class M>
|
||||
iterator insert_or_assign(
|
||||
const_iterator, key_type&& k, BOOST_FWD_REF(M) obj)
|
||||
iterator insert_or_assign(const_iterator, key_type&& k, M&& obj)
|
||||
{
|
||||
return table_
|
||||
.insert_or_assign_unique(std::move(k), std::forward<M>(obj))
|
||||
@ -489,8 +385,7 @@ namespace boost {
|
||||
template <class Key, class M>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
iterator>::type
|
||||
insert_or_assign(
|
||||
const_iterator, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj)
|
||||
insert_or_assign(const_iterator, Key&& k, M&& obj)
|
||||
{
|
||||
return table_
|
||||
.insert_or_assign_unique(std::forward<Key>(k), std::forward<M>(obj))
|
||||
@ -506,7 +401,7 @@ namespace boost {
|
||||
typename boost::enable_if_c<
|
||||
detail::transparent_non_iterable<Key, unordered_map>::value,
|
||||
size_type>::type
|
||||
erase(BOOST_FWD_REF(Key) k)
|
||||
erase(Key&& k)
|
||||
{
|
||||
return table_.erase_key_unique_impl(std::forward<Key>(k));
|
||||
}
|
||||
@ -635,18 +530,20 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
mapped_type&>::type
|
||||
operator[](BOOST_FWD_REF(Key) k);
|
||||
operator[](Key&& k);
|
||||
|
||||
mapped_type& at(const key_type&);
|
||||
mapped_type const& at(const key_type&) const;
|
||||
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
mapped_type&>::type at(BOOST_FWD_REF(Key) k);
|
||||
mapped_type&>::type
|
||||
at(Key&& k);
|
||||
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
mapped_type const&>::type at(BOOST_FWD_REF(Key) k) const;
|
||||
mapped_type const&>::type
|
||||
at(Key&& k) const;
|
||||
|
||||
// bucket interface
|
||||
|
||||
@ -667,7 +564,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
size_type>::type
|
||||
bucket(BOOST_FWD_REF(Key) k) const
|
||||
bucket(Key&& k) const
|
||||
{
|
||||
return table_.hash_to_bucket(table_.hash(std::forward<Key>(k)));
|
||||
}
|
||||
@ -964,7 +861,7 @@ namespace boost {
|
||||
|
||||
// emplace
|
||||
|
||||
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
|
||||
template <class... Args> iterator emplace(Args&&... args)
|
||||
{
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
@ -972,7 +869,7 @@ namespace boost {
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
iterator emplace_hint(const_iterator hint, Args&&... args)
|
||||
{
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
@ -1064,7 +961,7 @@ namespace boost {
|
||||
typename boost::enable_if_c<
|
||||
detail::transparent_non_iterable<Key, unordered_multimap>::value,
|
||||
size_type>::type
|
||||
erase(BOOST_FWD_REF(Key) k)
|
||||
erase(Key&& k)
|
||||
{
|
||||
return table_.erase_key_equiv_impl(std::forward<Key>(k));
|
||||
}
|
||||
@ -1197,7 +1094,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
size_type>::type
|
||||
bucket(BOOST_FWD_REF(Key) k) const
|
||||
bucket(Key&& k) const
|
||||
{
|
||||
return table_.hash_to_bucket(table_.hash(std::forward<Key>(k)));
|
||||
}
|
||||
@ -1711,7 +1608,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
typename unordered_map<K, T, H, P, A>::mapped_type&>::type
|
||||
unordered_map<K, T, H, P, A>::operator[](BOOST_FWD_REF(Key) k)
|
||||
unordered_map<K, T, H, P, A>::operator[](Key&& k)
|
||||
{
|
||||
return table_.try_emplace_unique(std::forward<Key>(k)).first->second;
|
||||
}
|
||||
@ -1752,7 +1649,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
typename unordered_map<K, T, H, P, A>::mapped_type&>::type
|
||||
unordered_map<K, T, H, P, A>::at(BOOST_FWD_REF(Key) k)
|
||||
unordered_map<K, T, H, P, A>::at(Key&& k)
|
||||
{
|
||||
typedef typename table::node_pointer node_pointer;
|
||||
|
||||
@ -1770,7 +1667,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
typename unordered_map<K, T, H, P, A>::mapped_type const&>::type
|
||||
unordered_map<K, T, H, P, A>::at(BOOST_FWD_REF(Key) k) const
|
||||
unordered_map<K, T, H, P, A>::at(Key&& k) const
|
||||
{
|
||||
typedef typename table::node_pointer node_pointer;
|
||||
|
||||
|
@ -196,66 +196,15 @@ namespace boost {
|
||||
|
||||
// emplace
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <class... Args>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args)
|
||||
template <class... Args> std::pair<iterator, bool> emplace(Args&&... args)
|
||||
{
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(std::forward<Args>(args)...),
|
||||
std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
|
||||
|
||||
// 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(std::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0>
|
||||
std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(std::forward<A0>(a0)),
|
||||
boost::unordered::detail::create_emplace_args(std::forward<A0>(a0)));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
std::pair<iterator, bool> emplace(
|
||||
BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return table_.emplace_unique(
|
||||
table::extractor::extract(std::forward<A0>(a0), std::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::forward<A1>(a1)));
|
||||
}
|
||||
|
||||
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_unique(
|
||||
table::extractor::extract(std::forward<A0>(a0), std::forward<A1>(a1)),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::forward<A1>(a1), std::forward<A2>(a2)));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
iterator emplace_hint(const_iterator hint, Args&&... args)
|
||||
{
|
||||
return table_.emplace_hint_unique(hint,
|
||||
table::extractor::extract(std::forward<Args>(args)...),
|
||||
@ -276,7 +225,7 @@ namespace boost {
|
||||
typename boost::enable_if_c<
|
||||
detail::transparent_non_iterable<Key, unordered_set>::value,
|
||||
std::pair<iterator, bool> >::type
|
||||
insert(BOOST_FWD_REF(Key) k)
|
||||
insert(Key&& k)
|
||||
{
|
||||
return table_.try_emplace_unique(std::forward<Key>(k));
|
||||
}
|
||||
@ -295,7 +244,7 @@ namespace boost {
|
||||
typename boost::enable_if_c<
|
||||
detail::transparent_non_iterable<Key, unordered_set>::value,
|
||||
iterator>::type
|
||||
insert(const_iterator hint, BOOST_FWD_REF(Key) k)
|
||||
insert(const_iterator hint, Key&& k)
|
||||
{
|
||||
return table_.try_emplace_hint_unique(hint, std::forward<Key>(k));
|
||||
}
|
||||
@ -356,7 +305,7 @@ namespace boost {
|
||||
typename boost::enable_if_c<
|
||||
detail::transparent_non_iterable<Key, unordered_set>::value,
|
||||
size_type>::type
|
||||
erase(BOOST_FWD_REF(Key) k)
|
||||
erase(Key&& k)
|
||||
{
|
||||
return table_.erase_key_unique_impl(std::forward<Key>(k));
|
||||
}
|
||||
@ -469,7 +418,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
size_type>::type
|
||||
bucket(BOOST_FWD_REF(Key) k) const
|
||||
bucket(Key&& k) const
|
||||
{
|
||||
return table_.hash_to_bucket(table_.hash(std::forward<Key>(k)));
|
||||
}
|
||||
@ -757,65 +706,15 @@ namespace boost {
|
||||
|
||||
// emplace
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
|
||||
template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args)
|
||||
template <class... Args> iterator emplace(Args&&... args)
|
||||
{
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), std::forward<Args>(args)...)));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !BOOST_UNORDERED_SUN_WORKAROUNDS1
|
||||
|
||||
// 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(std::move(v));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0)
|
||||
{
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(), boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0)))));
|
||||
}
|
||||
|
||||
template <typename A0, typename A1>
|
||||
iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1)
|
||||
{
|
||||
return iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(
|
||||
std::forward<A0>(a0), std::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 iterator(table_.emplace_equiv(
|
||||
boost::unordered::detail::func::construct_node_from_args(
|
||||
table_.node_alloc(),
|
||||
boost::unordered::detail::create_emplace_args(std::forward<A0>(a0),
|
||||
std::forward<A1>(a1), std::forward<A2>(a2)))));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template <class... Args>
|
||||
iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args)
|
||||
iterator emplace_hint(const_iterator hint, Args&&... args)
|
||||
{
|
||||
return iterator(table_.emplace_hint_equiv(
|
||||
hint, boost::unordered::detail::func::construct_node_from_args(
|
||||
@ -999,7 +898,7 @@ namespace boost {
|
||||
template <class Key>
|
||||
typename boost::enable_if_c<detail::are_transparent<Key, H, P>::value,
|
||||
size_type>::type
|
||||
bucket(BOOST_FWD_REF(Key) k) const
|
||||
bucket(Key&& k) const
|
||||
{
|
||||
return table_.hash_to_bucket(table_.hash(std::forward<Key>(k)));
|
||||
}
|
||||
|
@ -214,21 +214,12 @@ namespace test
|
||||
::operator delete((void*)p);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V>
|
||||
void construct(U* p, V const& v)
|
||||
{
|
||||
detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
new (p) U(v);
|
||||
}
|
||||
#else
|
||||
template <class U, typename... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U>
|
||||
void destroy(U* p)
|
||||
|
@ -501,28 +501,15 @@ namespace test {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class Arg>
|
||||
void construct(U* p, Arg const& t)
|
||||
template <class U, class... Args> void construct(U* p, Args&&... args)
|
||||
{
|
||||
UNORDERED_SCOPE(allocator::construct(U*, Arg))
|
||||
{
|
||||
UNORDERED_EPOINT("Mock allocator construct function.")
|
||||
new (p) U(t);
|
||||
}
|
||||
test::detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
}
|
||||
#else
|
||||
template <class U, class... Args> void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
{
|
||||
UNORDERED_SCOPE(allocator::construct(U*, BOOST_FWD_REF(Args)...))
|
||||
UNORDERED_SCOPE(allocator::construct(U*, Args&&...))
|
||||
{
|
||||
UNORDERED_EPOINT("Mock allocator construct function.")
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
test::detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U>
|
||||
void destroy(U* p)
|
||||
@ -682,29 +669,16 @@ namespace test {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V>
|
||||
void construct(U* p, V const& v)
|
||||
{
|
||||
UNORDERED_SCOPE(allocator2::construct(U*, V))
|
||||
{
|
||||
UNORDERED_EPOINT("Mock allocator2 construct function.")
|
||||
new (p) U(v);
|
||||
}
|
||||
test::detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
}
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
UNORDERED_SCOPE(allocator2::construct(U*, BOOST_FWD_REF(Args)...))
|
||||
UNORDERED_SCOPE(allocator2::construct(U*, Args&&...))
|
||||
{
|
||||
UNORDERED_EPOINT("Mock allocator2 construct function.")
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
test::detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U>
|
||||
void destroy(U* p)
|
||||
|
@ -461,18 +461,11 @@ namespace test {
|
||||
::operator delete((void*)p.ptr_);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V> void construct(U* p, V const& v)
|
||||
{
|
||||
new ((void*)p) U(v);
|
||||
}
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
new ((void*)p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U> void destroy(U* p) { p->~U(); }
|
||||
|
||||
@ -535,18 +528,11 @@ namespace test {
|
||||
::operator delete((void*)p.ptr_);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U> void construct(U* p, U const& t)
|
||||
{
|
||||
new (p) U(t);
|
||||
}
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U> void destroy(U* p) { p->~U(); }
|
||||
|
||||
@ -613,18 +599,11 @@ namespace test {
|
||||
|
||||
void deallocate(T* p, std::size_t) { ::operator delete((void*)p); }
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V> void construct(U* p, V const& v)
|
||||
{
|
||||
new ((void*)p) U(v);
|
||||
}
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
new ((void*)p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U> void destroy(U* p) { p->~U(); }
|
||||
|
||||
|
@ -657,20 +657,12 @@ namespace test {
|
||||
::operator delete((void*)p.ptr_);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V> void construct(U* p, V const& v)
|
||||
{
|
||||
detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
new (p) U(v);
|
||||
}
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
detail::tracker.track_construct((void*)p, sizeof(U), tag_);
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class U> void destroy(U* p)
|
||||
{
|
||||
|
@ -87,15 +87,11 @@ public:
|
||||
::operator delete((void*)p.operator->());
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V> void construct(U* p, V const& v) { new (p) U(v); }
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
// msvc-12.0 and msvc-14.0 seem to eliminate the destructor call as we're only
|
||||
// ever using it with an int with has a trivial destructor so it eliminates
|
||||
@ -171,15 +167,11 @@ public:
|
||||
|
||||
void deallocate(pointer p, size_type) { ::operator delete((void*)p.ptr_); }
|
||||
|
||||
#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
|
||||
template <class U, class V> void construct(U* p, V const& v) { new (p) U(v); }
|
||||
#else
|
||||
template <class U, class... Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)... args)
|
||||
void construct(U* p, Args&&... args)
|
||||
{
|
||||
new (p) U(std::forward<Args>(args)...);
|
||||
}
|
||||
#endif
|
||||
|
||||
// msvc-12.0 and msvc-14.0 seem to eliminate the destructor call as we're only
|
||||
// ever using it with an int with has a trivial destructor so it eliminates
|
||||
|
Reference in New Issue
Block a user