| 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 | |
| 7 | // See http://www.boost.org/libs/any for Documentation. |
| 8 | |
| 9 | #ifndef BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED |
| 10 | #define BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED |
| 11 | |
| 12 | #include <boost/config.hpp> |
| 13 | #ifdef BOOST_HAS_PRAGMA_ONCE |
| 14 | # pragma once |
| 15 | #endif |
| 16 | |
| 17 | #ifndef BOOST_NO_RTTI |
| 18 | #include <typeinfo> |
| 19 | #endif |
| 20 | |
| 21 | #include <stdexcept> |
| 22 | |
| 23 | namespace boost { |
| 24 | |
| 25 | /// The exception thrown in the event of a failed boost::any_cast of |
| 26 | /// an boost::any, boost::anys::basic_any or boost::anys::unique_any value. |
| 27 | class BOOST_SYMBOL_VISIBLE bad_any_cast : |
| 28 | #ifndef BOOST_NO_RTTI |
| 29 | public std::bad_cast |
| 30 | #else |
| 31 | public std::exception |
| 32 | #endif |
| 33 | { |
| 34 | public: |
| 35 | const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE |
| 36 | { |
| 37 | return "boost::bad_any_cast: " |
| 38 | "failed conversion using boost::any_cast" ; |
| 39 | } |
| 40 | }; |
| 41 | |
| 42 | } // namespace boost |
| 43 | |
| 44 | |
| 45 | #endif // #ifndef BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED |
| 46 | |