From d26807fb05972c2af414df640252677687a7c043 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 23 May 2017 15:25:38 +0200 Subject: [PATCH] add explicit cast to requested type --- alib2common/src/core/castApi.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/alib2common/src/core/castApi.hpp b/alib2common/src/core/castApi.hpp index 6884d687f7..3379955b78 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 ) ) ); -- GitLab