]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | ////////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // (C) Copyright Ion Gaztanaga 2011-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 | ////////////////////////////////////////////////////////////////////////////// | |
7c673cae | 10 | #include <boost/container/uses_allocator_fwd.hpp> |
7c673cae FG |
11 | #include <boost/container/uses_allocator.hpp> |
12 | #include "propagation_test_allocator.hpp" | |
13 | ||
14 | struct not_uses_allocator | |
15 | {}; | |
16 | ||
17 | struct uses_allocator_and_not_convertible_to_int | |
18 | { | |
19 | typedef uses_allocator_and_not_convertible_to_int allocator_type; | |
20 | }; | |
21 | ||
22 | struct uses_allocator_and_convertible_to_int | |
23 | { | |
20effc67 | 24 | typedef long allocator_type; |
7c673cae FG |
25 | }; |
26 | ||
27 | struct uses_erased_type_allocator | |
28 | { | |
29 | typedef boost::container::erased_type allocator_type; | |
30 | }; | |
31 | ||
32 | ||
33 | int main() | |
34 | { | |
35 | using namespace boost::container; | |
36 | //Using dummy classes | |
37 | BOOST_STATIC_ASSERT(( false == uses_allocator | |
38 | < not_uses_allocator, int>::value )); | |
39 | ||
40 | BOOST_STATIC_ASSERT(( false == uses_allocator | |
41 | < uses_allocator_and_not_convertible_to_int, int>::value )); | |
42 | ||
43 | BOOST_STATIC_ASSERT(( true == uses_allocator | |
44 | < uses_allocator_and_convertible_to_int, int>::value )); | |
45 | ||
46 | BOOST_STATIC_ASSERT(( true == uses_allocator | |
47 | < uses_erased_type_allocator, int>::value )); | |
48 | ||
49 | //Using an allocator-like class | |
50 | BOOST_STATIC_ASSERT(( false == uses_allocator | |
51 | < allocator_argument_tester<NotUsesAllocator, 0> | |
52 | , propagation_test_allocator<float, 0> | |
53 | >::value )); | |
54 | BOOST_STATIC_ASSERT(( true == uses_allocator | |
55 | < allocator_argument_tester<ConstructiblePrefix, 0> | |
56 | , propagation_test_allocator<float, 0> | |
57 | >::value )); | |
58 | BOOST_STATIC_ASSERT(( true == uses_allocator | |
59 | < allocator_argument_tester<ConstructibleSuffix, 0> | |
60 | , propagation_test_allocator<float, 0> | |
61 | >::value )); | |
62 | BOOST_STATIC_ASSERT(( true == uses_allocator | |
63 | < allocator_argument_tester<ErasedTypeSuffix, 0> | |
64 | , propagation_test_allocator<float, 0> | |
65 | >::value )); | |
66 | BOOST_STATIC_ASSERT(( true == uses_allocator | |
67 | < allocator_argument_tester<ErasedTypePrefix, 0> | |
68 | , propagation_test_allocator<float, 0> | |
69 | >::value )); | |
70 | BOOST_STATIC_ASSERT(( true == constructible_with_allocator_prefix | |
71 | < allocator_argument_tester<ConstructiblePrefix, 0> >::value )); | |
72 | ||
73 | BOOST_STATIC_ASSERT(( true == constructible_with_allocator_suffix | |
74 | < allocator_argument_tester<ConstructibleSuffix, 0> >::value )); | |
75 | ||
76 | BOOST_STATIC_ASSERT(( true == constructible_with_allocator_prefix | |
77 | < allocator_argument_tester<ErasedTypePrefix, 0> >::value )); | |
78 | ||
79 | BOOST_STATIC_ASSERT(( true == constructible_with_allocator_suffix | |
80 | < allocator_argument_tester<ErasedTypeSuffix, 0> >::value )); | |
81 | return 0; | |
82 | } |