How to create a null Functor in C ++ (using the loki library)

Writing something like this with the loki library ,

typedef Functor<void> BitButtonPushHandler;

throws a compiler error, but it works

typedef Functor<void,TYPELIST_1(Matrix3D*)> Perspective;

Functor.h: 530: error: '((Loki :: FunctorHandler, int> *) this) → Loki :: FunctorHandler, int> :: f_' cannot be used as a function Functor.h: 530: error: return-statement with value, in function returning 'void'

Does anyone familiar with this library know how to get the first line to work?

+3
source share
2 answers

After looking at the source code, the definition of the Functor template is as follows:

template <typename R = void, class TList = NullType,
        template<class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>
    class Functor{...};

As indicated below, there are no valid typedefs, so you must specify all types (or accept all default values).

, , :

typedef Functor<> BitButtonPushHandler;

Functor ( Loki), typedef.

+3

, , ... , ...

using namespace Loki; 

...

0

Source: https://habr.com/ru/post/1699019/


All Articles