1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
## std_rtti
### Synopsis
Defined in <boost/openmethod/policies/std_rtti.hpp>.
```c++
namespace boost::openmethod::policies {
struct std_rtti : rtti {
template<class Class>
static auto static_type() -> type_id;
template<class Class>
static auto dynamic_type(const Class& obj) -> type_id;
template<typename Stream>
static auto type_name(type_id type, Stream& stream) -> void;
static auto type_index(type_id type) -> std::type_index;
template<typename D, typename B>
static auto dynamic_cast_ref(B&& obj) -> D;
};
} // boost::openmethod::policies
```
### Description
`std_rtti` is an implementation of the `rtti` policy that uses standard RTTI.
### Members
#### static_type
```c++
template<class Class>
static auto static_type() -> type_id;
```
Return the address of `Class`'s `type_info`, cast to a `type_id`.
#### dynamic_type
```c++
template<class Class>
static auto dynamic_type(const Class& obj) -> type_id;
```
Return the address of `obj`{empty}'s `type_info`, cast to a `type_id`.
#### type_name
```c++
template<typename Stream>
static auto type_name(type_id type, Stream& stream) -> void;
```
Write the demangled name of the class identified by `type` to `stream`.
Execute `stream << reinterpret_cast<const std::type_info*>(type)->name()`.
#### type_index
```c++
static auto type_index(type_id type) -> /*unspecified*/;
```
Return `std::type_index(*reinterpret_cast<const std::type_info*>(type))`.
The function is required because C++ does *not* guarantee that there is a single
instance of `std::type_info` for each specific type.
#### dynamic_cast_ref
```c++
template<typename Derived, typename Base>
static auto dynamic_cast_ref(Base&& obj) -> Derived;
```
Cast `obj` using the `dynamic_cast` operator.
|