diff --git a/alib2common/src/abstraction/AlgorithmRegistry.hpp b/alib2common/src/abstraction/AlgorithmRegistry.hpp index 8a499839a25fd3ef9cbe5978b9216b0f8dcbd4f2..54de155a923ca030b571874b4f794e778b29fb7c 100644 --- a/alib2common/src/abstraction/AlgorithmRegistry.hpp +++ b/alib2common/src/abstraction/AlgorithmRegistry.hpp @@ -33,10 +33,10 @@ class AlgorithmRegistry { template < class ObjectType, class Return, class ... Params > class MemberImpl : public Entry { - std::function < Return ( ObjectType *, Params ... ) > m_callback; + std::function < Return ( typename std::remove_reference < ObjectType >::type *, Params ... ) > m_callback; public: - MemberImpl ( std::function < Return ( ObjectType *, Params ... ) > callback ) : m_callback ( callback ) { + MemberImpl ( std::function < Return ( typename std::remove_reference < ObjectType >::type *, Params ... ) > callback ) : m_callback ( callback ) { } virtual std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( ) const override; @@ -111,14 +111,14 @@ public: std::string algorithm = ext::to_string < Algo > ( ) + "::" + methodName; ext::vector < ext::tuple < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier >, std::string > > params = convertParamTypes < ParamTypes ... > ( paramNames ); - params.insert ( params.begin ( ), convertParamType < ObjectType > ( "object" ) ); + params.insert ( params.begin ( ), convertParamType < ObjectType & > ( "object" ) ); ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > result = convertReturnType < ReturnType > ( ); if ( isRegistered ( algorithm, category, params ) ) throw exception::CommonException ( "Callback for " + algorithm + " already registered." ); - registerInternal ( std::move ( algorithm ), category, std::move ( result ), std::move ( params ), std::make_shared < MemberImpl < ObjectType, ReturnType, ParamTypes ... > > ( callback ) ); + registerInternal ( std::move ( algorithm ), category, std::move ( result ), std::move ( params ), std::make_shared < MemberImpl < ObjectType &, ReturnType, ParamTypes ... > > ( callback ) ); } template < class Algo, class ReturnType, class ... ParamTypes > diff --git a/alib2common/src/abstraction/MemberAbstraction.hpp b/alib2common/src/abstraction/MemberAbstraction.hpp index 86e17756cbcfe0710d8e54cdffb46bcf8f72d9d4..5b97189b1f4e825e1253fadb4b6fa67a3717645a 100644 --- a/alib2common/src/abstraction/MemberAbstraction.hpp +++ b/alib2common/src/abstraction/MemberAbstraction.hpp @@ -16,10 +16,10 @@ namespace abstraction { template < class ObjectType, class ReturnType, class ... ParamTypes > class MemberAbstraction : public NaryOperationAbstraction < ReturnType, ObjectType &, ParamTypes ... > { - std::function < ReturnType ( ObjectType *, ParamTypes ... ) > m_callback; + std::function < ReturnType ( typename std::remove_reference < ObjectType >::type *, ParamTypes ... ) > m_callback; public: - MemberAbstraction ( std::function < ReturnType ( ObjectType *, ParamTypes ... ) > callback ) : m_callback ( callback ) { + MemberAbstraction ( std::function < ReturnType ( typename std::remove_reference < ObjectType >::type *, ParamTypes ... ) > callback ) : m_callback ( callback ) { } virtual bool run ( ) override {