diff --git a/test/static_vector_test.cpp b/test/static_vector_test.cpp index 9527190..fcc5358 100644 --- a/test/static_vector_test.cpp +++ b/test/static_vector_test.cpp @@ -10,13 +10,10 @@ #include #include #include -#include +#include #include #include "../../intrusive/test/iterator_test.hpp" -#include -#include - #include "static_vector_test.hpp" @@ -42,12 +39,10 @@ void test_ctor_nc(size_t n) BOOST_TEST_THROWS( s.at(n), std::out_of_range ); if ( 1 < n ) { - T val10(10); - s[0] = val10; + s[0] = 10; BOOST_TEST(T(10) == s[0]); BOOST_TEST(T(10) == s.at(0)); - T val20(20); - s.at(1) = val20; + s.at(1) = 20; BOOST_TEST(T(20) == s[1]); BOOST_TEST(T(20) == s.at(1)); } @@ -122,12 +117,10 @@ void test_resize_nc(size_t n) BOOST_TEST_THROWS( s.at(n), std::out_of_range ); if ( 1 < n ) { - T val10(10); - s[0] = val10; + s[0] = 10; BOOST_TEST(T(10) == s[0]); BOOST_TEST(T(10) == s.at(0)); - T val20(20); - s.at(1) = val20; + s.at(1) = 20; BOOST_TEST(T(20) == s[1]); BOOST_TEST(T(20) == s.at(1)); } @@ -231,8 +224,8 @@ template void test_copy_and_assign_nd(T const& val) { static_vector s; - std::vector v; - std::list l; + vector v; + list l; for ( size_t i = 0 ; i < N ; ++i ) { @@ -265,22 +258,17 @@ void test_copy_and_assign_nd(T const& val) { static_vector s1(s); test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end()); - std::vector a(N, val); + vector a(N, val); s1.assign(N, val); test_compare_ranges(a.begin(), a.end(), s1.begin(), s1.end()); } - - stable_vector bsv(s.begin(), s.end()); - vector bv(s.begin(), s.end()); - test_copy_and_assign(bsv); - test_copy_and_assign(bv); } template void test_iterators_nd() { static_vector s; - std::vector v; + vector v; for ( size_t i = 0 ; i < N ; ++i ) { @@ -370,8 +358,8 @@ void test_insert_nd(T const& val) size_t h = N/2; static_vector s, ss; - std::vector v; - std::list l; + vector v; + list l; typedef typename static_vector::iterator It; @@ -419,11 +407,6 @@ void test_insert_nd(T const& val) test_insert(s, ss); test_insert(s, v); test_insert(s, l); - - stable_vector bsv(ss.begin(), ss.end()); - vector bv(ss.begin(), ss.end()); - test_insert(s, bv); - test_insert(s, bsv); } template @@ -821,3 +804,45 @@ int main(int, char* []) return boost::report_errors(); } +/* + +#include +#include + +struct S_trivial { +int i; +}; +static_assert(std::is_nothrow_move_constructible::value, ""); +static_assert(std::is_nothrow_move_assignable::value, ""); + +struct S1 { +int i = 0; +}; +static_assert(std::is_nothrow_move_constructible::value, ""); +static_assert(std::is_nothrow_move_assignable::value, ""); + +struct S2 { +int i = 0; +S2(S2&&) noexcept; +S2& operator=(S2&&) noexcept; +}; +static_assert(std::is_nothrow_move_constructible::value, ""); +static_assert(std::is_nothrow_move_assignable::value, ""); + +// Succeed +static_assert(std::is_nothrow_move_constructible>::value, ""); +static_assert(std::is_nothrow_move_assignable>::value, ""); + +// Fail +static_assert(std::is_nothrow_move_constructible>::value, ""); +static_assert(std::is_nothrow_move_assignable>::value, ""); + +// Fail +static_assert(std::is_nothrow_move_constructible>::value, ""); +static_assert(std::is_nothrow_move_assignable>::value, ""); + +int main() +{ + return 0; +} +*/