27template<
typename To,
typename From>
29 std::is_pointer_v<To> &&
39template<
typename To,
typename From>
40requires std::is_pointer_v<To>
44 return dynamic_cast<To
>(p);
63 requires(T
const &a, T
const &b)
65 { a != b } -> std::convertible_to<bool>;
83template<
typename From,
typename To>
85 requires(From
const& f)
87 {
static_cast<To
>(f) } -> std::same_as<To>;
104 requires(std::ostream& os, T
const& t)
106 { os << t } -> std::same_as<std::ostream&>;
116 s <<
typeid(T).name();
117 if constexpr (std::is_const_v<typename std::remove_reference<T>::type>)
119 if constexpr (std::is_reference_v<T>)
Allows to detect (at compilation time) whether the call static_cast<To>(from) (where from is of type ...
Definition Metaprogramming.h:84
Definition Metaprogramming.h:28
Allows to detect whether a type defines operator!= at compile time.
Definition Metaprogramming.h:62
Allows to detect whether a type defines ostream << x at compile time.
Definition Metaprogramming.h:103
Definition CircularBuffer.h:27
std::string typeString()
typeid(T).name() does not account for const or reference.
Definition Metaprogramming.h:113
constexpr To safe_dynamic_cast(From *p) noexcept
dynamic_cast<U *>(x) does not compile if x is not polymorphic.
Definition Metaprogramming.h:41