]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/core/test/noinit_adaptor_test.cpp
2 Copyright 2019 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/core/noinit_adaptor.hpp>
9 #include <boost/core/default_allocator.hpp>
10 #include <boost/core/lightweight_test.hpp>
15 : public boost::default_allocator
<T
> {
19 typedef creator
<U
> other
;
26 creator(const creator
<U
>& other
)
27 : state_(other
.state()) { }
29 template<class U
, class V
>
30 void construct(U
*, const V
&) {
31 BOOST_ERROR("construct");
36 BOOST_ERROR("destroy");
47 template<class T
, class U
>
49 operator==(const creator
<T
>& lhs
, const creator
<U
>& rhs
)
51 return lhs
.state() == rhs
.state();
54 template<class T
, class U
>
56 operator!=(const creator
<T
>& lhs
, const creator
<U
>& rhs
)
77 operator==(const type
& lhs
, const type
& rhs
)
79 return lhs
.value() == rhs
.value();
83 void test(const A
& allocator
)
85 std::vector
<typename
A::value_type
, A
> v(allocator
);
87 BOOST_TEST(v
.front() == 1);
95 test(boost::noinit_adaptor
<creator
<int> >(1));
96 test(boost::noinit_adaptor
<creator
<type
> >(2));
97 test(boost::noinit_adapt(creator
<int>(3)));
98 test(boost::noinit_adapt(creator
<type
>(4)));
99 return boost::report_errors();