diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 702121dd..2d5a3d09 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -661,7 +661,7 @@ namespace boost { template 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)...); @@ -723,8 +723,8 @@ namespace boost { detect_boost_tuple::value && detect_boost_tuple::value, void>::type - construct_from_args(Alloc& alloc, std::pair* address, - BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + construct_from_args( + Alloc& alloc, std::pair* 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 inline typename boost::allocator_pointer::type construct_node( - Alloc& alloc, BOOST_FWD_REF(U) x) + Alloc& alloc, U&& x) { node_constructor a(alloc); a.create_node(); @@ -872,7 +872,7 @@ namespace boost { template inline typename boost::allocator_pointer::type - construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k) + construct_node_pair(Alloc& alloc, Key&& k) { node_constructor a(alloc); a.create_node(); @@ -893,8 +893,7 @@ namespace boost { template inline typename boost::allocator_pointer::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 a(alloc); a.create_node(); @@ -915,8 +914,7 @@ namespace boost { template inline typename boost::allocator_pointer::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 a(alloc); a.create_node(); @@ -938,15 +936,14 @@ namespace boost { template inline typename boost::allocator_pointer::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(k)); } template inline typename boost::allocator_pointer::type - construct_node_from_key( - std::pair*, Alloc& alloc, BOOST_FWD_REF(Key) k) + construct_node_from_key(std::pair*, Alloc& alloc, Key&& k) { return construct_node_pair(alloc, std::forward(k)); } @@ -2081,8 +2078,7 @@ namespace boost { } } - template - emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k) + template 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 - 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 - 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 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 - 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)); diff --git a/include/boost/unordered/unordered_map.hpp b/include/boost/unordered/unordered_map.hpp index f6f6ec21..443e0ce4 100644 --- a/include/boost/unordered/unordered_map.hpp +++ b/include/boost/unordered/unordered_map.hpp @@ -198,118 +198,21 @@ namespace boost { // emplace -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template - std::pair emplace(BOOST_FWD_REF(Args)... args) + template std::pair emplace(Args&&... args) { return table_.emplace_unique( table::extractor::extract(std::forward(args)...), std::forward(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 emplace( - boost::unordered::detail::empty_emplace = - boost::unordered::detail::empty_emplace(), - value_type v = value_type()) - { - return this->emplace(std::move(v)); - } - -#endif - - template - std::pair emplace(BOOST_FWD_REF(A0) a0) - { - return table_.emplace_unique( - table::extractor::extract(std::forward(a0)), - boost::unordered::detail::create_emplace_args(std::forward(a0))); - } - - template - std::pair emplace( - BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) - { - return table_.emplace_unique( - table::extractor::extract(std::forward(a0), std::forward(a1)), - boost::unordered::detail::create_emplace_args( - std::forward(a0), std::forward(a1))); - } - - template - std::pair 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), std::forward(a1)), - boost::unordered::detail::create_emplace_args( - std::forward(a0), std::forward(a1), std::forward(a2))); - } - -#endif - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - 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)...), std::forward(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 - iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0) - { - return table_.emplace_hint_unique(hint, - table::extractor::extract(std::forward(a0)), - boost::unordered::detail::create_emplace_args(std::forward(a0))); - } - - template - 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), std::forward(a1)), - boost::unordered::detail::create_emplace_args( - std::forward(a0), std::forward(a1))); - } - - template - 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), std::forward(a1)), - boost::unordered::detail::create_emplace_args( - std::forward(a0), std::forward(a1), std::forward(a2))); - } - -#endif - std::pair insert(value_type const& x) { return this->emplace(x); @@ -367,7 +270,7 @@ namespace boost { typename boost::enable_if_c< detail::transparent_non_iterable::value, node_type>::type - extract(BOOST_FWD_REF(Key) k) + extract(Key&& k) { return node_type(table_.extract_by_key_impl(std::forward(k)), table_.node_alloc()); @@ -396,15 +299,13 @@ namespace boost { #endif template - std::pair try_emplace( - key_type const& k, BOOST_FWD_REF(Args)... args) + std::pair try_emplace(key_type const& k, Args&&... args) { return table_.try_emplace_unique(k, std::forward(args)...); } template - std::pair try_emplace( - key_type&& k, BOOST_FWD_REF(Args)... args) + std::pair try_emplace(key_type&& k, Args&&... args) { return table_.try_emplace_unique( std::move(k), std::forward(args)...); @@ -422,15 +323,14 @@ namespace boost { template 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)...); } template - 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)...); @@ -447,15 +347,13 @@ namespace boost { } template - std::pair insert_or_assign( - key_type const& k, BOOST_FWD_REF(M) obj) + std::pair insert_or_assign(key_type const& k, M&& obj) { return table_.insert_or_assign_unique(k, std::forward(obj)); } template - std::pair insert_or_assign( - key_type&& k, BOOST_FWD_REF(M) obj) + std::pair insert_or_assign(key_type&& k, M&& obj) { return table_.insert_or_assign_unique( std::move(k), std::forward(obj)); @@ -464,22 +362,20 @@ namespace boost { template typename boost::enable_if_c::value, std::pair >::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(k), std::forward(obj)); } template - 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(obj)).first; } template - 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(obj)) @@ -489,8 +385,7 @@ namespace boost { template typename boost::enable_if_c::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(k), std::forward(obj)) @@ -506,7 +401,7 @@ namespace boost { typename boost::enable_if_c< detail::transparent_non_iterable::value, size_type>::type - erase(BOOST_FWD_REF(Key) k) + erase(Key&& k) { return table_.erase_key_unique_impl(std::forward(k)); } @@ -635,18 +530,20 @@ namespace boost { template typename boost::enable_if_c::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 typename boost::enable_if_c::value, - mapped_type&>::type at(BOOST_FWD_REF(Key) k); + mapped_type&>::type + at(Key&& k); template typename boost::enable_if_c::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 typename boost::enable_if_c::value, size_type>::type - bucket(BOOST_FWD_REF(Key) k) const + bucket(Key&& k) const { return table_.hash_to_bucket(table_.hash(std::forward(k))); } @@ -964,7 +861,7 @@ namespace boost { // emplace - template iterator emplace(BOOST_FWD_REF(Args)... args) + template iterator emplace(Args&&... args) { return iterator(table_.emplace_equiv( boost::unordered::detail::func::construct_node_from_args( @@ -972,7 +869,7 @@ namespace boost { } template - 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::value, size_type>::type - erase(BOOST_FWD_REF(Key) k) + erase(Key&& k) { return table_.erase_key_equiv_impl(std::forward(k)); } @@ -1197,7 +1094,7 @@ namespace boost { template typename boost::enable_if_c::value, size_type>::type - bucket(BOOST_FWD_REF(Key) k) const + bucket(Key&& k) const { return table_.hash_to_bucket(table_.hash(std::forward(k))); } @@ -1711,7 +1608,7 @@ namespace boost { template typename boost::enable_if_c::value, typename unordered_map::mapped_type&>::type - unordered_map::operator[](BOOST_FWD_REF(Key) k) + unordered_map::operator[](Key&& k) { return table_.try_emplace_unique(std::forward(k)).first->second; } @@ -1752,7 +1649,7 @@ namespace boost { template typename boost::enable_if_c::value, typename unordered_map::mapped_type&>::type - unordered_map::at(BOOST_FWD_REF(Key) k) + unordered_map::at(Key&& k) { typedef typename table::node_pointer node_pointer; @@ -1770,7 +1667,7 @@ namespace boost { template typename boost::enable_if_c::value, typename unordered_map::mapped_type const&>::type - unordered_map::at(BOOST_FWD_REF(Key) k) const + unordered_map::at(Key&& k) const { typedef typename table::node_pointer node_pointer; diff --git a/include/boost/unordered/unordered_set.hpp b/include/boost/unordered/unordered_set.hpp index 2b709644..727f70ad 100644 --- a/include/boost/unordered/unordered_set.hpp +++ b/include/boost/unordered/unordered_set.hpp @@ -196,66 +196,15 @@ namespace boost { // emplace -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template - std::pair emplace(BOOST_FWD_REF(Args)... args) + template std::pair emplace(Args&&... args) { return table_.emplace_unique( table::extractor::extract(std::forward(args)...), std::forward(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 emplace( - boost::unordered::detail::empty_emplace = - boost::unordered::detail::empty_emplace(), - value_type v = value_type()) - { - return this->emplace(std::move(v)); - } - -#endif - - template - std::pair emplace(BOOST_FWD_REF(A0) a0) - { - return table_.emplace_unique( - table::extractor::extract(std::forward(a0)), - boost::unordered::detail::create_emplace_args(std::forward(a0))); - } - - template - std::pair emplace( - BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) - { - return table_.emplace_unique( - table::extractor::extract(std::forward(a0), std::forward(a1)), - boost::unordered::detail::create_emplace_args( - std::forward(a0), std::forward(a1))); - } - - template - std::pair 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), std::forward(a1)), - boost::unordered::detail::create_emplace_args( - std::forward(a0), std::forward(a1), std::forward(a2))); - } - -#endif - template - 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)...), @@ -276,7 +225,7 @@ namespace boost { typename boost::enable_if_c< detail::transparent_non_iterable::value, std::pair >::type - insert(BOOST_FWD_REF(Key) k) + insert(Key&& k) { return table_.try_emplace_unique(std::forward(k)); } @@ -295,7 +244,7 @@ namespace boost { typename boost::enable_if_c< detail::transparent_non_iterable::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(k)); } @@ -356,7 +305,7 @@ namespace boost { typename boost::enable_if_c< detail::transparent_non_iterable::value, size_type>::type - erase(BOOST_FWD_REF(Key) k) + erase(Key&& k) { return table_.erase_key_unique_impl(std::forward(k)); } @@ -469,7 +418,7 @@ namespace boost { template typename boost::enable_if_c::value, size_type>::type - bucket(BOOST_FWD_REF(Key) k) const + bucket(Key&& k) const { return table_.hash_to_bucket(table_.hash(std::forward(k))); } @@ -757,65 +706,15 @@ namespace boost { // emplace -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template iterator emplace(BOOST_FWD_REF(Args)... args) + template iterator emplace(Args&&... args) { return iterator(table_.emplace_equiv( boost::unordered::detail::func::construct_node_from_args( table_.node_alloc(), std::forward(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 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))))); - } - - template - 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), std::forward(a1))))); - } - - template - 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), - std::forward(a1), std::forward(a2))))); - } - -#endif - template - 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 typename boost::enable_if_c::value, size_type>::type - bucket(BOOST_FWD_REF(Key) k) const + bucket(Key&& k) const { return table_.hash_to_bucket(table_.hash(std::forward(k))); } diff --git a/test/objects/cxx11_allocator.hpp b/test/objects/cxx11_allocator.hpp index 922e908c..4ca0cc62 100644 --- a/test/objects/cxx11_allocator.hpp +++ b/test/objects/cxx11_allocator.hpp @@ -214,21 +214,12 @@ namespace test ::operator delete((void*)p); } -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - void construct(U* p, V const& v) - { - detail::tracker.track_construct((void*)p, sizeof(U), tag_); - new (p) U(v); - } -#else template - 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)...); } -#endif template void destroy(U* p) diff --git a/test/objects/exception.hpp b/test/objects/exception.hpp index f2b2c1d0..91093fcc 100644 --- a/test/objects/exception.hpp +++ b/test/objects/exception.hpp @@ -501,28 +501,15 @@ namespace test { } } -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - void construct(U* p, Arg const& t) + template 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 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)...); } test::detail::tracker.track_construct((void*)p, sizeof(U), tag_); } -#endif template void destroy(U* p) @@ -682,29 +669,16 @@ namespace test { } } -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - 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 - 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)...); } test::detail::tracker.track_construct((void*)p, sizeof(U), tag_); } -#endif template void destroy(U* p) diff --git a/test/objects/minimal.hpp b/test/objects/minimal.hpp index a7936abc..ff2c6275 100644 --- a/test/objects/minimal.hpp +++ b/test/objects/minimal.hpp @@ -461,18 +461,11 @@ namespace test { ::operator delete((void*)p.ptr_); } -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template void construct(U* p, V const& v) - { - new ((void*)p) U(v); - } -#else template - void construct(U* p, BOOST_FWD_REF(Args)... args) + void construct(U* p, Args&&... args) { new ((void*)p) U(std::forward(args)...); } -#endif template 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 void construct(U* p, U const& t) - { - new (p) U(t); - } -#else template - void construct(U* p, BOOST_FWD_REF(Args)... args) + void construct(U* p, Args&&... args) { new (p) U(std::forward(args)...); } -#endif template 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 void construct(U* p, V const& v) - { - new ((void*)p) U(v); - } -#else template - void construct(U* p, BOOST_FWD_REF(Args)... args) + void construct(U* p, Args&&... args) { new ((void*)p) U(std::forward(args)...); } -#endif template void destroy(U* p) { p->~U(); } diff --git a/test/objects/test.hpp b/test/objects/test.hpp index f0f804a9..a769c6ef 100644 --- a/test/objects/test.hpp +++ b/test/objects/test.hpp @@ -657,20 +657,12 @@ namespace test { ::operator delete((void*)p.ptr_); } -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template void construct(U* p, V const& v) - { - detail::tracker.track_construct((void*)p, sizeof(U), tag_); - new (p) U(v); - } -#else template - 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)...); } -#endif template void destroy(U* p) { diff --git a/test/unordered/scary_tests.cpp b/test/unordered/scary_tests.cpp index 2111b700..ac158da6 100644 --- a/test/unordered/scary_tests.cpp +++ b/test/unordered/scary_tests.cpp @@ -87,15 +87,11 @@ public: ::operator delete((void*)p.operator->()); } -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template void construct(U* p, V const& v) { new (p) U(v); } -#else template - void construct(U* p, BOOST_FWD_REF(Args)... args) + void construct(U* p, Args&&... args) { new (p) U(std::forward(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 void construct(U* p, V const& v) { new (p) U(v); } -#else template - void construct(U* p, BOOST_FWD_REF(Args)... args) + void construct(U* p, Args&&... args) { new (p) U(std::forward(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