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 // [email protected] 11 12 #include "boost/optional/optional.hpp" 13 14 #ifdef BOOST_BORLANDC 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 { operator ==SemiRegular24private: void operator==(SemiRegular const&) const {} operator !=SemiRegular25private: void operator!=(SemiRegular const&) const {} 26 }; 27 test_equal_to_none_of_noncomparable_T()28void 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 main()39int main() 40 { 41 test_equal_to_none_of_noncomparable_T(); 42 return boost::report_errors(); 43 } 44