1 //////////////////////////////////////////////////////////////////////////////
2 //
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)
6 //
7 // See http://www.boost.org/libs/container for documentation.
8 //
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
15 #include <iostream>
16
17 #include "movable_int.hpp"
18 #include "dummy_test_allocator.hpp"
19
20 using namespace boost::container;
21
22 typedef boost::container::dtl::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> pair_t;
23
24 namespace boost {
25 namespace container {
26
27 //Explicit instantiation to detect compilation errors
28
29 namespace dtl {
30
31 template class flat_tree
32 < pair_t
33 , select1st<test::movable_and_copyable_int>
34 , std::less<test::movable_and_copyable_int>
35 , test::simple_allocator<pair_t>
36 >;
37
38 template class flat_tree
39 < pair_t
40 , select1st<test::movable_and_copyable_int>
41 , std::less<test::movable_and_copyable_int>
42 , std::allocator<pair_t>
43 >;
44
45 template class flat_tree
46 < pair_t
47 , select1st<test::movable_and_copyable_int>
48 , std::less<test::movable_and_copyable_int>
49 , small_vector<pair_t, 10>
50 >;
51
52 template class flat_tree
53 < pair_t
54 , select1st<test::movable_and_copyable_int>
55 , std::less<test::movable_and_copyable_int>
56 , stable_vector<pair_t>
57 >;
58
59 template class flat_tree
60 < test::movable_and_copyable_int
61 , identity<test::movable_and_copyable_int>
62 , std::less<test::movable_and_copyable_int>
63 , test::simple_allocator<test::movable_and_copyable_int>
64 >;
65
66 template class flat_tree
67 < test::movable_and_copyable_int
68 , identity<test::movable_and_copyable_int>
69 , std::less<test::movable_and_copyable_int>
70 , std::allocator<test::movable_and_copyable_int>
71 >;
72
73 template class flat_tree
74 < test::movable_and_copyable_int
75 , identity<test::movable_and_copyable_int>
76 , std::less<test::movable_and_copyable_int>
77 , small_vector<test::movable_and_copyable_int, 10>
78 >;
79
80 template class flat_tree
81 < test::movable_and_copyable_int
82 , identity<test::movable_and_copyable_int>
83 , std::less<test::movable_and_copyable_int>
84 , stable_vector<test::movable_and_copyable_int>
85 >;
86
87 template class flat_tree
88 < test::movable_and_copyable_int
89 , identity<test::movable_and_copyable_int>
90 , std::less<test::movable_and_copyable_int>
91 , static_vector<test::movable_and_copyable_int, 10>
92 >;
93
94 } //dtl {
95 }} //boost::container
96
97 #if (__cplusplus > 201103L)
98 #include <vector>
99
100 namespace boost{
101 namespace container{
102 namespace dtl{
103
104 template class flat_tree
105 < test::movable_and_copyable_int
106 , identity<test::movable_and_copyable_int>
107 , std::less<test::movable_and_copyable_int>
108 , std::vector<test::movable_and_copyable_int>
109 >;
110
111 template class flat_tree
112 < pair_t
113 , select1st<test::movable_and_copyable_int>
114 , std::less<test::movable_and_copyable_int>
115 , std::vector<pair_t>
116 >;
117
118 } //dtl {
119 }} //boost::container
120
121 #endif
122
main()123 int main ()
124 {
125 ////////////////////////////////////
126 // has_trivial_destructor_after_move testing
127 ////////////////////////////////////
128 // default
129 {
130 typedef boost::container::dtl::flat_tree<int, boost::container::dtl::identity<int>,
131 std::less<int>, void> tree;
132 typedef tree::container_type container_type;
133 typedef tree::key_compare key_compare;
134 if (boost::has_trivial_destructor_after_move<tree>::value !=
135 boost::has_trivial_destructor_after_move<container_type>::value &&
136 boost::has_trivial_destructor_after_move<key_compare>::value) {
137 std::cerr << "has_trivial_destructor_after_move(default allocator) test failed" << std::endl;
138 return 1;
139 }
140 }
141 // std::allocator
142 {
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 if (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 std::cerr << "has_trivial_destructor_after_move(std::allocator) test failed" << std::endl;
151 return 1;
152 }
153 }
154
155 return 0;
156 }
157