]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/optional/test/optional_test_sfinae_friendly_ctor.cpp
1 // Copyright (C) 2014 Andrzej Krzemienski.
3 // Use, modification, and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/lib/optional for documentation.
9 // You are welcome to contact the author at:
12 #include "boost/optional/optional.hpp"
18 using boost::optional
;
20 #if (!defined BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT)
27 explicit Resource(const X
&) {}
30 BOOST_STATIC_ASSERT(( boost::is_constructible
<Resource
, const X
&>::value
));
31 BOOST_STATIC_ASSERT(( !boost::is_constructible
<Resource
, const Y
&>::value
));
33 BOOST_STATIC_ASSERT(( boost::is_constructible
<optional
<Resource
>, const X
&>::value
));
34 BOOST_STATIC_ASSERT(( !boost::is_constructible
<optional
<Resource
>, const Y
&>::value
));
36 #ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
37 BOOST_STATIC_ASSERT(( boost::is_constructible
< optional
< optional
<int> >, optional
<int> >::value
));
38 BOOST_STATIC_ASSERT(( !boost::is_constructible
< optional
<int>, optional
< optional
<int> > >::value
));
40 BOOST_STATIC_ASSERT(( boost::is_constructible
< optional
< optional
<int> >, const optional
<int>& >::value
));
41 BOOST_STATIC_ASSERT(( !boost::is_constructible
< optional
<int>, const optional
< optional
<int> >& >::value
));
43 BOOST_STATIC_ASSERT(( boost::is_constructible
<optional
<Resource
>, const optional
<X
>&>::value
));
44 BOOST_STATIC_ASSERT(( !boost::is_constructible
<optional
<Resource
>, const optional
<Y
>&>::value
));