]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/optional/test/optional_test_sfinae_friendly_ctor.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / optional / test / optional_test_sfinae_friendly_ctor.cpp
CommitLineData
b32b8144
FG
1// Copyright (C) 2014 Andrzej Krzemienski.
2//
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)
6//
7// See http://www.boost.org/lib/optional for documentation.
8//
9// You are welcome to contact the author at:
10// akrzemi1@gmail.com
11
12#include "boost/optional/optional.hpp"
13
20effc67 14#ifdef BOOST_BORLANDC
b32b8144
FG
15#pragma hdrstop
16#endif
17
18using boost::optional;
19
20#if (!defined BOOST_OPTIONAL_DETAIL_NO_IS_CONSTRUCTIBLE_TRAIT)
21
22struct X {};
23struct Y {};
24
25struct Resource
26{
27 explicit Resource(const X&) {}
28};
29
30BOOST_STATIC_ASSERT(( boost::is_constructible<Resource, const X&>::value ));
31BOOST_STATIC_ASSERT(( !boost::is_constructible<Resource, const Y&>::value ));
32
33BOOST_STATIC_ASSERT(( boost::is_constructible<optional<Resource>, const X&>::value ));
34BOOST_STATIC_ASSERT(( !boost::is_constructible<optional<Resource>, const Y&>::value ));
35
36#ifndef BOOST_OPTIONAL_DETAIL_NO_SFINAE_FRIENDLY_CONSTRUCTORS
37BOOST_STATIC_ASSERT(( boost::is_constructible< optional< optional<int> >, optional<int> >::value ));
38BOOST_STATIC_ASSERT(( !boost::is_constructible< optional<int>, optional< optional<int> > >::value ));
39
40BOOST_STATIC_ASSERT(( boost::is_constructible< optional< optional<int> >, const optional<int>& >::value ));
41BOOST_STATIC_ASSERT(( !boost::is_constructible< optional<int>, const optional< optional<int> >& >::value ));
42
43BOOST_STATIC_ASSERT(( boost::is_constructible<optional<Resource>, const optional<X>&>::value ));
44BOOST_STATIC_ASSERT(( !boost::is_constructible<optional<Resource>, const optional<Y>&>::value ));
45#endif
46
47#endif
48
49int main() { }