removed limitation with legacy libstdc++-v3

This commit is contained in:
joaquintides
2020-01-29 20:50:53 +01:00
parent c0e8b940da
commit 0f41301229
3 changed files with 15 additions and 14 deletions
+3
View File
@@ -1128,6 +1128,9 @@ to allow for the definition of container-level `operator<` and related operators
* Fixed a bug by which elements were copied rather than moved in
allocator-extended move construction and move assigment between collections
with non-propagating, unequal allocators.
* Allocator-extended move construction no longer decays to allocator-extended copy
construction for the legacy version of libstdc++-v3 shipped with GCC 4.8
(which can also be used by Clang).
[endsect]
@@ -1,4 +1,4 @@
/* Copyright 2016-2018 Joaquin M Lopez Munoz.
/* Copyright 2016-2020 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -15,6 +15,7 @@
#include <boost/detail/workaround.hpp>
#include <functional>
#include <iterator>
#include <memory>
#include <type_traits>
#include <typeinfo>
@@ -183,7 +184,6 @@ private:
/* std::unordered_map(const allocator_type&),
* std::unordered_map(const unordered_map&,const allocator_type&) and
* std::unordered_map(unordered_map&&,const allocator_type&) not available.
* We make move construction decay to copy construction.
*/
template<typename UnorderedMap>
@@ -200,10 +200,17 @@ private:
const typename std::decay<UnorderedMap>::type::allocator_type& al)
{
using RawUnorderedMap=typename std::decay<UnorderedMap>::type;
using iterator=typename std::conditional<
!std::is_lvalue_reference<UnorderedMap>::value&&
!std::is_const<UnorderedMap>::value,
std::move_iterator<typename RawUnorderedMap::iterator>,
typename RawUnorderedMap::const_iterator
>::type;
return RawUnorderedMap{
x.begin(),x.end(),0,typename RawUnorderedMap::hasher{},
typename RawUnorderedMap::key_equal{},al
iterator{x.begin()},iterator{x.end()},0,
typename RawUnorderedMap::hasher{},typename RawUnorderedMap::key_equal{},
al
};
}
#else
+1 -10
View File
@@ -1,4 +1,4 @@
/* Copyright 2016-2019 Joaquin M Lopez Munoz.
/* Copyright 2016-2020 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -88,16 +88,7 @@ void test_allocator_aware_construction()
auto d3=get_layout_data<Types...>(p3);
BOOST_TEST(p3==p);
#if BOOST_WORKAROUND(BOOST_LIBSTDCXX_VERSION,<40900)
/* Limitations from libstdc++-v3 force move construction with allocator
* to decay to copy construction with allocator.
*/
(void)(d2==d3); /* Wunused-variable */
#else
if(AlwaysEqual)BOOST_TEST(d2==d3);
#endif
BOOST_TEST(p2.empty());
do_((BOOST_TEST(!p2.template is_registered<Types>()),0)...);