]>
Commit | Line | Data |
---|---|---|
7c673cae 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 |
7c673cae FG |
15 | #pragma hdrstop |
16 | #endif | |
17 | ||
18 | #include "boost/core/lightweight_test.hpp" | |
19 | #include "boost/none.hpp" | |
20 | ||
21 | ||
22 | struct SemiRegular // no operator== | |
23 | { | |
24 | private: void operator==(SemiRegular const&) const {} | |
25 | private: void operator!=(SemiRegular const&) const {} | |
26 | }; | |
27 | ||
28 | void test_equal_to_none_of_noncomparable_T() | |
29 | { | |
30 | boost::optional<SemiRegular> i = SemiRegular(); | |
31 | boost::optional<SemiRegular> o; | |
32 | ||
33 | BOOST_TEST(i != boost::none); | |
34 | BOOST_TEST(boost::none != i); | |
35 | BOOST_TEST(o == boost::none); | |
36 | BOOST_TEST(boost::none == o); | |
37 | } | |
38 | ||
39 | int main() | |
40 | { | |
41 | test_equal_to_none_of_noncomparable_T(); | |
42 | return boost::report_errors(); | |
43 | } |