]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (C) 2015 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 | #define BOOST_OPTIONAL_CONFIG_NO_RVALUE_REFERENCES | |
13 | #include "boost/optional/optional.hpp" | |
14 | ||
20effc67 | 15 | #ifdef BOOST_BORLANDC |
7c673cae FG |
16 | #pragma hdrstop |
17 | #endif | |
18 | ||
19 | #include "boost/core/lightweight_test.hpp" | |
20 | ||
21 | ||
22 | struct Wrapper | |
23 | { | |
24 | operator int () { return 9; } | |
25 | operator boost::optional<int> () { return 7; } | |
26 | }; | |
27 | ||
28 | void test() | |
29 | { | |
30 | #if (!defined BOOST_NO_CXX11_RVALUE_REFERENCES) | |
31 | boost::optional<int> v = Wrapper(); | |
32 | BOOST_TEST(v); | |
33 | BOOST_TEST_EQ(*v, 7); | |
34 | #endif | |
35 | } | |
36 | ||
37 | int main() | |
38 | { | |
39 | test(); | |
40 | return boost::report_errors(); | |
41 | } |