]>
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()
45 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
46 boost::alignment::aligned_allocator
<int, Alignment
> a2(a1
);
50 template<std::size_t Alignment
>
53 boost::alignment::aligned_allocator
<char, Alignment
> a1
;
54 typename
boost::alignment::aligned_allocator
<char,
55 Alignment
>::template rebind
<int>::other
a2(a1
);
59 template<std::size_t Alignment
>
62 test_allocate
<Alignment
>();
63 test_construct
<Alignment
>();
64 test_constructor
<Alignment
>();
65 test_rebind
<Alignment
>();
79 return boost::report_errors();