/src/boost/boost/any/bad_any_cast.hpp
Line | Count | Source |
1 | | // Copyright Antony Polukhin, 2020-2026. |
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/any/detail/config.hpp> |
13 | | |
14 | | #if !defined(BOOST_USE_MODULES) || defined(BOOST_ANY_INTERFACE_UNIT) |
15 | | |
16 | | #ifndef BOOST_ANY_INTERFACE_UNIT |
17 | | #include <boost/config.hpp> |
18 | | #ifdef BOOST_HAS_PRAGMA_ONCE |
19 | | # pragma once |
20 | | #endif |
21 | | |
22 | | #ifndef BOOST_NO_RTTI |
23 | | #include <typeinfo> |
24 | | #endif |
25 | | |
26 | | #include <stdexcept> |
27 | | #endif // #ifndef BOOST_ANY_INTERFACE_UNIT |
28 | | |
29 | | namespace boost { |
30 | | |
31 | | BOOST_ANY_BEGIN_MODULE_EXPORT |
32 | | |
33 | | /// The exception thrown in the event of a failed boost::any_cast of |
34 | | /// an boost::any, boost::anys::basic_any or boost::anys::unique_any value. |
35 | | class BOOST_SYMBOL_VISIBLE bad_any_cast : |
36 | | #ifndef BOOST_NO_RTTI |
37 | | public std::bad_cast |
38 | | #else |
39 | | public std::exception |
40 | | #endif |
41 | | { |
42 | | public: |
43 | | const char * what() const BOOST_NOEXCEPT_OR_NOTHROW override |
44 | 0 | { |
45 | 0 | return "boost::bad_any_cast: " |
46 | 0 | "failed conversion using boost::any_cast"; |
47 | 0 | } |
48 | | }; |
49 | | |
50 | | BOOST_ANY_END_MODULE_EXPORT |
51 | | |
52 | | } // namespace boost |
53 | | |
54 | | #endif // #if !defined(BOOST_USE_MODULES) || defined(BOOST_ANY_INTERFACE_UNIT) |
55 | | |
56 | | #endif // #ifndef BOOST_ANYS_BAD_ANY_CAST_HPP_INCLUDED |