| 1 | // Copyright 2020 Peter Dimov. |
|---|---|
| 2 | // Distributed under the Boost Software License, Version 1.0. |
| 3 | // http://www.boost.org/LICENSE_1_0.txt |
| 4 | |
| 5 | #include <boost/system/is_error_code_enum.hpp> |
| 6 | #include <boost/core/lightweight_test.hpp> |
| 7 | |
| 8 | enum error |
| 9 | { |
| 10 | success = 0, |
| 11 | e1, |
| 12 | e2, |
| 13 | e3 |
| 14 | }; |
| 15 | |
| 16 | namespace boost |
| 17 | { |
| 18 | namespace system |
| 19 | { |
| 20 | |
| 21 | template<> struct is_error_code_enum< ::error > |
| 22 | { |
| 23 | static const bool value = true; |
| 24 | }; |
| 25 | |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | boost::system::error_code make_error_code( ::error e ); |
| 30 | |
| 31 | enum not_error |
| 32 | { |
| 33 | }; |
| 34 | |
| 35 | int main() |
| 36 | { |
| 37 | BOOST_TEST( boost::system::is_error_code_enum< ::error >::value ); |
| 38 | BOOST_TEST( !boost::system::is_error_code_enum< ::not_error >::value ); |
| 39 | |
| 40 | return boost::report_errors(); |
| 41 | } |
| 42 |
