Fix "-Wdeprecated-copy" warnings

This commit is contained in:
Ion Gaztañaga
2020-08-09 23:21:46 +02:00
parent 06417de498
commit 974e8e641a
8 changed files with 118 additions and 83 deletions
+30 -20
View File
@@ -27,6 +27,13 @@ typedef std::pair<const test::movable_and_copyable_int, test::movable_and_copyab
class recursive_map
{
public:
recursive_map()
{}
recursive_map(const recursive_map &x)
: map_(x.map_)
{}
recursive_map & operator=(const recursive_map &x)
{ id_ = x.id_; map_ = x.map_; return *this; }
@@ -44,6 +51,13 @@ class recursive_map
class recursive_multimap
{
public:
recursive_multimap()
{}
recursive_multimap(const recursive_multimap &x)
: multimap_(x.multimap_)
{}
recursive_multimap & operator=(const recursive_multimap &x)
{ id_ = x.id_; multimap_ = x.multimap_; return *this; }
@@ -644,21 +658,19 @@ int main ()
{
typedef boost::container::map<int, int> cont;
typedef boost::container::dtl::tree<value_type, int, std::less<int>, void, void> tree;
if (boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value) {
std::cerr << "has_trivial_destructor_after_move(map, default allocator) test failed" << std::endl;
return 1;
}
BOOST_STATIC_ASSERT_MSG(
!(boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value)
, "has_trivial_destructor_after_move(map, default allocator) test failed");
}
// std::allocator
{
typedef boost::container::map<int, int, std::less<int>, std::allocator<value_type> > cont;
typedef boost::container::dtl::tree<value_type, int, std::less<int>, std::allocator<value_type>, void> tree;
if (boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value) {
std::cerr << "has_trivial_destructor_after_move(map, std::allocator) test failed" << std::endl;
return 1;
}
BOOST_STATIC_ASSERT_MSG(
!(boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value)
, "has_trivial_destructor_after_move(map, std::allocator) test failed");
}
//
// multimap
@@ -668,21 +680,19 @@ int main ()
// default allocator
typedef boost::container::multimap<int, int> cont;
typedef boost::container::dtl::tree<value_type, int, std::less<int>, void, void> tree;
if (boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value) {
std::cerr << "has_trivial_destructor_after_move(multimap, default allocator) test failed" << std::endl;
return 1;
}
BOOST_STATIC_ASSERT_MSG(
!(boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value)
, "has_trivial_destructor_after_move(multimap, default allocator) test failed");
}
// std::allocator
{
typedef boost::container::multimap<int, int, std::less<int>, std::allocator<value_type> > cont;
typedef boost::container::dtl::tree<value_type, int, std::less<int>, std::allocator<value_type>, void> tree;
if (boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value) {
std::cerr << "has_trivial_destructor_after_move(multimap, std::allocator) test failed" << std::endl;
return 1;
}
BOOST_STATIC_ASSERT_MSG(
!(boost::has_trivial_destructor_after_move<cont>::value !=
boost::has_trivial_destructor_after_move<tree>::value)
, "has_trivial_destructor_after_move(multimap, std::allocator) test failed");
}
}