]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/align/test/aligned_allocator_test.cpp
2 Copyright 2014 Glen Joseph Fernandes
5 Distributed under the Boost Software License, Version 1.0.
6 (http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/align/aligned_allocator.hpp>
9 #include <boost/align/is_aligned.hpp>
10 #include <boost/core/lightweight_test.hpp>
13 template<std::size_t Alignment
>
17 boost::alignment::aligned_allocator
<int, Alignment
> a
;
18 int* p
= a
.allocate(1);
20 BOOST_TEST(boost::alignment::is_aligned(p
, Alignment
));
25 boost::alignment::aligned_allocator
<int, Alignment
> a
;
26 int* p
= a
.allocate(0);
31 template<std::size_t Alignment
>
34 boost::alignment::aligned_allocator
<int, Alignment
> a
;
35 int* p
= a
.allocate(1);
42 template<std::size_t Alignment
>
43 void test_constructor()
46 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
47 boost::alignment::aligned_allocator
<int, Alignment
> a2(a1
);
51 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
52 boost::alignment::aligned_allocator
<void, Alignment
> a2(a1
);
56 boost::alignment::aligned_allocator
<void, Alignment
> a1
;
57 boost::alignment::aligned_allocator
<char, Alignment
> a2(a1
);
62 template<std::size_t Alignment
>
66 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
67 typename
boost::alignment::aligned_allocator
<char,
68 Alignment
>::template rebind
<int>::other
a2(a1
);
72 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
73 typename
boost::alignment::aligned_allocator
<char,
74 Alignment
>::template rebind
<void>::other
a2(a1
);
78 boost::alignment::aligned_allocator
<void, Alignment
> a1
;
79 typename
boost::alignment::aligned_allocator
<void,
80 Alignment
>::template rebind
<char>::other
a2(a1
);
85 template<std::size_t Alignment
>
88 test_allocate
<Alignment
>();
89 test_construct
<Alignment
>();
90 test_constructor
<Alignment
>();
91 test_rebind
<Alignment
>();
105 return boost::report_errors();