stl_register_class.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. //
  2. // Copyright (c) 2013-2019 Antony Polukhin.
  3. //
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. //
  8. #ifndef BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP
  9. #define BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP
  10. /// \file stl_register_class.hpp
  11. /// \brief Contains BOOST_TYPE_INDEX_REGISTER_CLASS macro implementation that uses boost::typeindex::stl_type_index.
  12. /// Not intended for inclusion from user's code.
  13. #include <boost/type_index/stl_type_index.hpp>
  14. #ifdef BOOST_HAS_PRAGMA_ONCE
  15. # pragma once
  16. #endif
  17. namespace boost { namespace typeindex { namespace detail {
  18. template <class T>
  19. inline const stl_type_index::type_info_t& stl_construct_typeid_ref(const T*) BOOST_NOEXCEPT {
  20. return typeid(T);
  21. }
  22. }}} // namespace boost::typeindex::detail
  23. /// @cond
  24. #define BOOST_TYPE_INDEX_REGISTER_CLASS \
  25. virtual const boost::typeindex::stl_type_index::type_info_t& boost_type_index_type_id_runtime_() const BOOST_NOEXCEPT { \
  26. return boost::typeindex::detail::stl_construct_typeid_ref(this); \
  27. } \
  28. /**/
  29. /// @endcond
  30. #endif // BOOST_TYPE_INDEX_STL_REGISTER_CLASS_HPP