]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
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> | |
1e59de90 | 14 | #include <boost/static_assert.hpp> |
b32b8144 | 15 | |
92f5a8d4 TL |
16 | #include <iostream> |
17 | ||
b32b8144 FG |
18 | #include "movable_int.hpp" |
19 | #include "dummy_test_allocator.hpp" | |
1e59de90 | 20 | #include <functional> //std::less |
b32b8144 FG |
21 | |
22 | using namespace boost::container; | |
23 | ||
11fdf7f2 | 24 | typedef boost::container::dtl::pair<test::movable_and_copyable_int, test::movable_and_copyable_int> pair_t; |
b32b8144 FG |
25 | |
26 | namespace boost { | |
27 | namespace container { | |
28 | ||
29 | //Explicit instantiation to detect compilation errors | |
30 | ||
11fdf7f2 | 31 | namespace dtl { |
b32b8144 FG |
32 | |
33 | template class flat_tree | |
34 | < pair_t | |
35 | , select1st<test::movable_and_copyable_int> | |
36 | , std::less<test::movable_and_copyable_int> | |
37 | , test::simple_allocator<pair_t> | |
38 | >; | |
39 | ||
40 | template class flat_tree | |
41 | < pair_t | |
42 | , select1st<test::movable_and_copyable_int> | |
43 | , std::less<test::movable_and_copyable_int> | |
44 | , std::allocator<pair_t> | |
45 | >; | |
46 | ||
47 | template class flat_tree | |
48 | < pair_t | |
49 | , select1st<test::movable_and_copyable_int> | |
50 | , std::less<test::movable_and_copyable_int> | |
51 | , small_vector<pair_t, 10> | |
52 | >; | |
53 | ||
54 | template class flat_tree | |
55 | < pair_t | |
56 | , select1st<test::movable_and_copyable_int> | |
57 | , std::less<test::movable_and_copyable_int> | |
58 | , stable_vector<pair_t> | |
59 | >; | |
60 | ||
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> | |
66 | >; | |
67 | ||
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> | |
73 | >; | |
74 | ||
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> | |
80 | >; | |
81 | ||
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> | |
87 | >; | |
88 | ||
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> | |
94 | >; | |
95 | ||
11fdf7f2 | 96 | } //dtl { |
b32b8144 FG |
97 | }} //boost::container |
98 | ||
99 | #if (__cplusplus > 201103L) | |
100 | #include <vector> | |
101 | ||
102 | namespace boost{ | |
103 | namespace container{ | |
11fdf7f2 | 104 | namespace dtl{ |
b32b8144 FG |
105 | |
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> | |
111 | >; | |
112 | ||
113 | template class flat_tree | |
114 | < pair_t | |
115 | , select1st<test::movable_and_copyable_int> | |
116 | , std::less<test::movable_and_copyable_int> | |
117 | , std::vector<pair_t> | |
118 | >; | |
119 | ||
11fdf7f2 | 120 | } //dtl { |
b32b8144 FG |
121 | }} //boost::container |
122 | ||
123 | #endif | |
124 | ||
125 | int main () | |
126 | { | |
92f5a8d4 TL |
127 | //////////////////////////////////// |
128 | // has_trivial_destructor_after_move testing | |
129 | //////////////////////////////////// | |
130 | // default | |
131 | { | |
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; | |
1e59de90 | 136 | BOOST_STATIC_ASSERT_MSG ((boost::has_trivial_destructor_after_move<tree>::value == |
92f5a8d4 | 137 | boost::has_trivial_destructor_after_move<container_type>::value && |
1e59de90 TL |
138 | boost::has_trivial_destructor_after_move<key_compare>::value) |
139 | , "has_trivial_destructor_after_move(default allocator) test failed"); | |
92f5a8d4 TL |
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; | |
1e59de90 | 147 | BOOST_STATIC_ASSERT_MSG( (boost::has_trivial_destructor_after_move<tree>::value == |
92f5a8d4 | 148 | boost::has_trivial_destructor_after_move<container_type>::value && |
1e59de90 TL |
149 | boost::has_trivial_destructor_after_move<key_compare>::value) |
150 | , "has_trivial_destructor_after_move(std::allocator) test failed"); | |
92f5a8d4 TL |
151 | } |
152 | ||
b32b8144 FG |
153 | return 0; |
154 | } |