17#ifndef LIB_CASTABLE_H_
18#define LIB_CASTABLE_H_
22#include "lib/exceptions.h"
55 auto *result =
to<T>();
56 BUG_CHECK(result,
"Cast failed: %1% is not a %2%",
this,
typeid(T).name());
63 auto *result =
to<T>();
64 BUG_CHECK(result,
"Cast failed: %1% is not a %2%",
this,
typeid(T).name());
T & as()
Tries to convert the class to type T. A BUG occurs if the cast fails.
Definition castable.h:48
const T * checkedTo() const
Performs a checked cast. A BUG occurs if the cast fails.
Definition castable.h:54
const T & as() const
Tries to convert the class to type T. A BUG occurs if the cast fails.
Definition castable.h:42
T * checkedTo()
Performs a checked cast. A BUG occurs if the cast fails.
Definition castable.h:62
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
T * to() noexcept
Definition rtti.h:226