]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | ////////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // (C) Copyright Ion Gaztanaga 2015-2015. 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 | ||
11 | #include <boost/container/vector.hpp> | |
12 | ||
13 | struct empty | |
14 | { | |
15 | friend bool operator == (const empty &, const empty &){ return true; } | |
16 | friend bool operator < (const empty &, const empty &){ return true; } | |
17 | }; | |
18 | ||
19 | template class ::boost::container::vector<empty>; | |
92f5a8d4 TL |
20 | volatile ::boost::container::vector<empty> dummy; |
21 | ||
22 | #include <boost/container/allocator.hpp> | |
23 | #include "movable_int.hpp" | |
24 | #include "dummy_test_allocator.hpp" | |
25 | ||
20effc67 TL |
26 | class CustomAllocator |
27 | { | |
28 | public: | |
29 | typedef int value_type; | |
30 | typedef value_type* pointer; | |
31 | typedef const value_type* const_pointer; | |
32 | typedef unsigned short size_type; | |
33 | typedef short difference_type; | |
34 | ||
35 | pointer allocate(size_type count) | |
36 | { return (pointer)new char[sizeof(value_type)*count]; } | |
37 | ||
38 | void deallocate(pointer ptr, size_type ) | |
39 | { delete [](char*)ptr; } | |
40 | ||
41 | friend bool operator==(CustomAllocator const&, CustomAllocator const&) BOOST_NOEXCEPT | |
42 | { return true; } | |
43 | ||
44 | friend bool operator!=(CustomAllocator const& x, CustomAllocator const& y) BOOST_NOEXCEPT | |
45 | { return !(x == y); } | |
46 | }; | |
47 | ||
48 | ||
92f5a8d4 TL |
49 | namespace boost { |
50 | namespace container { | |
51 | ||
52 | //Explicit instantiation to detect compilation errors | |
53 | template class boost::container::vector | |
54 | < test::movable_and_copyable_int | |
55 | , test::simple_allocator<test::movable_and_copyable_int> >; | |
56 | ||
57 | template class boost::container::vector | |
58 | < test::movable_and_copyable_int | |
59 | , allocator<test::movable_and_copyable_int> >; | |
60 | ||
61 | template class vec_iterator<int*, true >; | |
62 | template class vec_iterator<int*, false>; | |
63 | ||
20effc67 TL |
64 | //Test stored_size option |
65 | template class boost::container::vector< test::movable_and_copyable_int | |
66 | , new_allocator<test::movable_and_copyable_int> | |
67 | , vector_options< stored_size<unsigned short> >::type | |
68 | >; | |
69 | ||
70 | //test custom allocator with small size_type | |
71 | template class boost::container::vector<int, CustomAllocator>; | |
72 | ||
92f5a8d4 TL |
73 | } //namespace boost { |
74 | } //namespace container { | |
7c673cae FG |
75 | |
76 | int main() | |
77 | { | |
7c673cae FG |
78 | return 0; |
79 | } |