Use BOOST_STATIC_ASSERT_MSG for constant checks

This commit is contained in:
Ion Gaztañaga
2022-01-04 00:36:36 +01:00
parent 576e15d6f6
commit 53a020f1f1
2 changed files with 12 additions and 20 deletions

View File

@ -11,6 +11,7 @@
#include <boost/container/small_vector.hpp>
#include <boost/container/stable_vector.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/static_assert.hpp>
#include <iostream>
@ -132,12 +133,10 @@ int main ()
std::less<int>, void> tree;
typedef tree::container_type container_type;
typedef tree::key_compare key_compare;
if (boost::has_trivial_destructor_after_move<tree>::value !=
BOOST_STATIC_ASSERT_MSG ((boost::has_trivial_destructor_after_move<tree>::value ==
boost::has_trivial_destructor_after_move<container_type>::value &&
boost::has_trivial_destructor_after_move<key_compare>::value) {
std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl;
return 1;
}
boost::has_trivial_destructor_after_move<key_compare>::value)
, "has_trivial_destructor_after_move(default allocator) test failed");
}
// std::allocator
{
@ -145,12 +144,10 @@ int main ()
std::less<int>, std::allocator<int> > tree;
typedef tree::container_type container_type;
typedef tree::key_compare key_compare;
if (boost::has_trivial_destructor_after_move<tree>::value !=
BOOST_STATIC_ASSERT_MSG( (boost::has_trivial_destructor_after_move<tree>::value ==
boost::has_trivial_destructor_after_move<container_type>::value &&
boost::has_trivial_destructor_after_move<key_compare>::value) {
std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl;
return 1;
}
boost::has_trivial_destructor_after_move<key_compare>::value)
, "has_trivial_destructor_after_move(std::allocator) test failed");
}
return 0;

View File

@ -92,13 +92,10 @@ int main ()
typedef tree::allocator_type allocator_type;
typedef boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef tree::key_compare key_compare;
if (boost::has_trivial_destructor_after_move<tree>::value !=
BOOST_STATIC_ASSERT_MSG((boost::has_trivial_destructor_after_move<tree>::value ==
boost::has_trivial_destructor_after_move<allocator_type>::value &&
boost::has_trivial_destructor_after_move<pointer>::value &&
boost::has_trivial_destructor_after_move<key_compare>::value) {
std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl;
return 1;
}
boost::has_trivial_destructor_after_move<key_compare>::value), "has_trivial_destructor_after_move(default allocator) test failed");
}
// std::allocator
{
@ -106,13 +103,11 @@ int main ()
typedef tree::allocator_type allocator_type;
typedef boost::container::allocator_traits<allocator_type>::pointer pointer;
typedef tree::key_compare key_compare;
if (boost::has_trivial_destructor_after_move<tree>::value !=
BOOST_STATIC_ASSERT_MSG ((boost::has_trivial_destructor_after_move<tree>::value ==
boost::has_trivial_destructor_after_move<allocator_type>::value &&
boost::has_trivial_destructor_after_move<pointer>::value &&
boost::has_trivial_destructor_after_move<key_compare>::value) {
std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl;
return 1;
}
boost::has_trivial_destructor_after_move<key_compare>::value)
, "has_trivial_destructor_after_move(std::allocator) test failed");
}
return 0;