]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/hof/test/implicit.cpp
1 /*=============================================================================
2 Copyright (c) 2017 Paul Fultz II
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
7 #include <boost/hof/implicit.hpp>
21 struct auto_caster_noexcept
24 T
operator()(U x
) noexcept
30 struct auto_caster_foo
33 explicit auto_caster_foo(int ip
) : i(ip
) {}
36 // TODO: Test template constraint on conversion operator
37 static constexpr boost::hof::implicit
<auto_caster
> auto_cast
= {};
43 // auto_caster_foo x = 1;
44 auto_caster_foo x
= auto_cast(1);
45 BOOST_HOF_TEST_CHECK(1 == i
);
46 BOOST_HOF_TEST_CHECK(1 == x
.i
);
49 #if BOOST_HOF_HAS_NOEXCEPT_DEDUCTION
52 boost::hof::implicit
<auto_caster_noexcept
> lauto_cast
{};
54 static_assert(noexcept(int(lauto_cast(f
))), "noexcept implicit");