ctti_print_name.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //
  2. // Copyright 2012-2019 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. #include <iostream>
  8. // This cpp file:
  9. // * tests BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING macro
  10. // * outputs full ctti name so that TypeIndex library could be adjust to new compiler without requesting regression tester's help
  11. #define BOOST_TYPE_INDEX_CTTI_USER_DEFINED_PARSING (0,0,false,"")
  12. #include <boost/type_index/ctti_type_index.hpp>
  13. namespace user_defined_namespace {
  14. class user_defined_class {};
  15. }
  16. class empty
  17. {
  18. };
  19. int main()
  20. {
  21. using namespace boost::typeindex;
  22. std::cout << "int: "
  23. << ctti_type_index::type_id<int>() << '\n';
  24. std::cout << "double: "
  25. << ctti_type_index::type_id<double>() << '\n';
  26. std::cout << "user_defined_namespace::user_defined_class: "
  27. << ctti_type_index::type_id<user_defined_namespace::user_defined_class>() << '\n';
  28. std::cout << "empty:"
  29. << ctti_type_index::type_id<empty>() << '\n';
  30. return 0;
  31. }