| 1 | // |
|---|---|
| 2 | // Copyright 2012-2024 Antony Polukhin. |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See |
| 5 | // accompanying file LICENSE_1_0.txt or copy at |
| 6 | // http://www.boost.org/LICENSE_1_0.txt) |
| 7 | |
| 8 | #include <iostream> |
| 9 | |
| 10 | // This cpp file: |
| 11 | // * tests BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro |
| 12 | // * outputs full ctti name so that TypeIndex library could be adjust to new compiler without requesting regression tester's help |
| 13 | #define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0,0,false,"") |
| 14 | #include <boost/type_index/ctti_type_index.hpp> |
| 15 | |
| 16 | namespace user_defined_namespace { |
| 17 | class user_defined_class {}; |
| 18 | } |
| 19 | |
| 20 | class empty |
| 21 | { |
| 22 | }; |
| 23 | |
| 24 | |
| 25 | int main() |
| 26 | { |
| 27 | using namespace boost::typeindex; |
| 28 | |
| 29 | std::cout << "int: " |
| 30 | << ctti_type_index::type_id<int>() << '\n'; |
| 31 | |
| 32 | std::cout << "double: " |
| 33 | << ctti_type_index::type_id<double>() << '\n'; |
| 34 | |
| 35 | std::cout << "user_defined_namespace::user_defined_class: " |
| 36 | << ctti_type_index::type_id<user_defined_namespace::user_defined_class>() << '\n'; |
| 37 | |
| 38 | |
| 39 | std::cout << "empty:" |
| 40 | << ctti_type_index::type_id<empty>() << '\n'; |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 |
