]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/align/test/aligned_allocator_test.cpp
2 (c) 2014 Glen Joseph Fernandes
3 <glenjofe -at- gmail.com>
5 Distributed under the Boost Software
7 http://boost.org/LICENSE_1_0.txt
9 #include <boost/align/aligned_allocator.hpp>
10 #include <boost/align/is_aligned.hpp>
11 #include <boost/core/lightweight_test.hpp>
14 template<std::size_t Alignment
>
18 boost::alignment::aligned_allocator
<int, Alignment
> a
;
19 int* p
= a
.allocate(1);
21 BOOST_TEST(boost::alignment::is_aligned(p
, Alignment
));
26 boost::alignment::aligned_allocator
<int, Alignment
> a
;
27 int* p
= a
.allocate(0);
32 template<std::size_t Alignment
>
35 boost::alignment::aligned_allocator
<int, Alignment
> a
;
36 int* p
= a
.allocate(1);
43 template<std::size_t Alignment
>
44 void test_constructor()
46 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
47 boost::alignment::aligned_allocator
<int, Alignment
> a2(a1
);
51 template<std::size_t Alignment
>
54 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
55 typename
boost::alignment::aligned_allocator
<char,
56 Alignment
>::template rebind
<int>::other
a2(a1
);
60 template<std::size_t Alignment
>
63 test_allocate
<Alignment
>();
64 test_construct
<Alignment
>();
65 test_constructor
<Alignment
>();
66 test_rebind
<Alignment
>();
80 return boost::report_errors();