diff --git a/alib2common/src/core/castApi.hpp b/alib2common/src/core/castApi.hpp index 6884d687f75bf234b03725629c774e39c52cbd90..3379955b78584d26e2e27e959edbaa45bfef8839 100644 --- a/alib2common/src/core/castApi.hpp +++ b/alib2common/src/core/castApi.hpp @@ -81,6 +81,12 @@ struct castApi { introspection::Casts::registerCast < From, To > ( ); } + To explicitCast ( const alib::ObjectBase & from ) { + alib::Object res = cast ( from ); + To & target = static_cast < To & > ( res.getData ( ) ); + return To ( std::move ( target ) ); + } + template < class From > bool test ( ) { return castFunctions.count ( std::type_index ( typeid ( From ) ) );