mirror of
https://github.com/boostorg/container.git
synced 2026-01-25 16:52:48 +01:00
Make static_vector<T, N>'s destructor trivial if T is trivial.
This commit is contained in:
@@ -671,6 +671,35 @@ bool default_init_test()//Test for default initialization
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(BOOST_INTRUSIVE_CONCEPTS_BASED_OVERLOADING)
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
template<class T, bool Result>
|
||||
void static_vector_destructor_triviality_impl()
|
||||
{
|
||||
typedef static_vector<T, 10> vector_t;
|
||||
BOOST_CONTAINER_STATIC_ASSERT(( Result == std::is_trivially_destructible_v<vector_t> ));
|
||||
}
|
||||
|
||||
struct non_trivial
|
||||
{
|
||||
non_trivial(){}
|
||||
~non_trivial(){}
|
||||
};
|
||||
|
||||
void static_vector_triviality()
|
||||
{
|
||||
static_vector_destructor_triviality_impl<int, true>();
|
||||
static_vector_destructor_triviality_impl<float, true>();
|
||||
static_vector_destructor_triviality_impl<non_trivial, false>();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void static_vector_triviality(){}
|
||||
|
||||
#endif //BOOST_INTRUSIVE_CONCEPTS_BASED_OVERLOADING
|
||||
|
||||
int main(int, char* [])
|
||||
{
|
||||
@@ -787,6 +816,8 @@ int main(int, char* [])
|
||||
boost::intrusive::test::test_iterator_random< cont_int >(a);
|
||||
}
|
||||
|
||||
static_vector_triviality();
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user