1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2004-2013. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/container for documentation.
9 //////////////////////////////////////////////////////////////////////////////
10 #include <boost/container/detail/flat_tree.hpp>
11 #include <boost/container/small_vector.hpp>
12 #include <boost/container/stable_vector.hpp>
13 #include <boost/container/static_vector.hpp>
14 #include <boost/static_assert.hpp>
18 #include "movable_int.hpp"
19 #include "dummy_test_allocator.hpp"
20 #include <functional> //std::less
22 using namespace boost::container
;
24 typedef boost::container::dtl::pair
<test::movable_and_copyable_int
, test::movable_and_copyable_int
> pair_t
;
29 //Explicit instantiation to detect compilation errors
33 template class flat_tree
35 , select1st
<test::movable_and_copyable_int
>
36 , std::less
<test::movable_and_copyable_int
>
37 , test::simple_allocator
<pair_t
>
40 template class flat_tree
42 , select1st
<test::movable_and_copyable_int
>
43 , std::less
<test::movable_and_copyable_int
>
44 , std::allocator
<pair_t
>
47 template class flat_tree
49 , select1st
<test::movable_and_copyable_int
>
50 , std::less
<test::movable_and_copyable_int
>
51 , small_vector
<pair_t
, 10>
54 template class flat_tree
56 , select1st
<test::movable_and_copyable_int
>
57 , std::less
<test::movable_and_copyable_int
>
58 , stable_vector
<pair_t
>
61 template class flat_tree
62 < test::movable_and_copyable_int
63 , identity
<test::movable_and_copyable_int
>
64 , std::less
<test::movable_and_copyable_int
>
65 , test::simple_allocator
<test::movable_and_copyable_int
>
68 template class flat_tree
69 < test::movable_and_copyable_int
70 , identity
<test::movable_and_copyable_int
>
71 , std::less
<test::movable_and_copyable_int
>
72 , std::allocator
<test::movable_and_copyable_int
>
75 template class flat_tree
76 < test::movable_and_copyable_int
77 , identity
<test::movable_and_copyable_int
>
78 , std::less
<test::movable_and_copyable_int
>
79 , small_vector
<test::movable_and_copyable_int
, 10>
82 template class flat_tree
83 < test::movable_and_copyable_int
84 , identity
<test::movable_and_copyable_int
>
85 , std::less
<test::movable_and_copyable_int
>
86 , stable_vector
<test::movable_and_copyable_int
>
89 template class flat_tree
90 < test::movable_and_copyable_int
91 , identity
<test::movable_and_copyable_int
>
92 , std::less
<test::movable_and_copyable_int
>
93 , static_vector
<test::movable_and_copyable_int
, 10>
99 #if (__cplusplus > 201103L)
106 template class flat_tree
107 < test::movable_and_copyable_int
108 , identity
<test::movable_and_copyable_int
>
109 , std::less
<test::movable_and_copyable_int
>
110 , std::vector
<test::movable_and_copyable_int
>
113 template class flat_tree
115 , select1st
<test::movable_and_copyable_int
>
116 , std::less
<test::movable_and_copyable_int
>
117 , std::vector
<pair_t
>
121 }} //boost::container
127 ////////////////////////////////////
128 // has_trivial_destructor_after_move testing
129 ////////////////////////////////////
132 typedef boost::container::dtl::flat_tree
<int, boost::container::dtl::identity
<int>,
133 std::less
<int>, void> tree
;
134 typedef tree::container_type container_type
;
135 typedef tree::key_compare key_compare
;
136 BOOST_STATIC_ASSERT_MSG ((boost::has_trivial_destructor_after_move
<tree
>::value
==
137 boost::has_trivial_destructor_after_move
<container_type
>::value
&&
138 boost::has_trivial_destructor_after_move
<key_compare
>::value
)
139 , "has_trivial_destructor_after_move(default allocator) test failed");
143 typedef boost::container::dtl::flat_tree
<int, boost::container::dtl::identity
<int>,
144 std::less
<int>, std::allocator
<int> > tree
;
145 typedef tree::container_type container_type
;
146 typedef tree::key_compare key_compare
;
147 BOOST_STATIC_ASSERT_MSG( (boost::has_trivial_destructor_after_move
<tree
>::value
==
148 boost::has_trivial_destructor_after_move
<container_type
>::value
&&
149 boost::has_trivial_destructor_after_move
<key_compare
>::value
)
150 , "has_trivial_destructor_after_move(std::allocator) test failed");