tags:

views:

326

answers:

2

Writing something like this using the loki library,

typedef Functor<void> BitButtonPushHandler;

throws a compiler error, but this 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 a value, in function returning 'void'

Anyone familiar with this library know how to get the first line working?

+1  A: 

Looking at the source code, the Functor template definition is as follows:

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

As commented below, there are no template typedefs allowed, so all types (or accept all defaults) need to be specified.

You can just define as follows and let the defaults do the work:

typedef Functor<> BitButtonPushHandler;

This compiles for me with a small test Functor class (not the actual Loki one), and I can use the typedef successfully.

A: 

What I originally wrote worked... it was late, and I forgot about...

using namespace Loki;

...so sorry

CVertex