23 #ifndef CAST_H_INCLUDED 24 #define CAST_H_INCLUDED 27 #include <type_traits> 35 T pointer_to_object(
const Expr& expr)
37 auto const &pointed = *expr;
38 if (
typeid(T) !=
typeid(pointed)) {
39 std::cout <<
typeid(T).name() <<
"\n" 40 <<
typeid(pointed).name() <<
"\n";
42 "pointer_cast(const Expr&).");
45 return *
static_cast<T*
>(expr.get());
49 T& pointer_to_object_ref(
const Expr& expr)
51 auto const &pointed = *expr;
52 if (
typeid(T) !=
typeid(pointed))
54 "pointer_cast_ref(const Expr&).");
56 return *
static_cast<T*
>(expr.get());
60 T* shared_to_raw_ptr(
const Expr_c& expr)
62 auto const &pointed = *expr;
63 if (
typeid(T) !=
typeid(pointed))
65 "shared_to_raw_ptr(const Expr_c&).");
67 return static_cast<T*
>(expr.get());
72 Expr object_to_shared(T& csl_expr)
74 static_assert(std::is_base_of<Abstract, T>::value);
76 return csl_expr.self();
Namespace for csl library.
Definition: abreviation.h:34
File containing functions that are called by the program when something wrong happened: determines th...
void callError(cslError::Error error, const std::string &caller, T spec)
Displays an error message depending on the error error, the name of the caller function caller and a ...
Definition: error.h:115
Base classes for all exprs in the program.