bad_any_cast.hpp 921 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright Antony Polukhin, 2020-2023.
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org/libs/any for Documentation.
  7. #ifndef BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED
  8. #define BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED
  9. #include <boost/config.hpp>
  10. #ifdef BOOST_HAS_PRAGMA_ONCE
  11. # pragma once
  12. #endif
  13. #ifndef BOOST_NO_RTTI
  14. #include <typeinfo>
  15. #endif
  16. #include <stdexcept>
  17. namespace boost {
  18. class BOOST_SYMBOL_VISIBLE bad_any_cast :
  19. #ifndef BOOST_NO_RTTI
  20. public std::bad_cast
  21. #else
  22. public std::exception
  23. #endif
  24. {
  25. public:
  26. const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
  27. {
  28. return "boost::bad_any_cast: "
  29. "failed conversion using boost::any_cast";
  30. }
  31. };
  32. } // namespace boost
  33. #endif // #ifndef BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED