template <class EventType>
class IEvent;
class IEventable;
typedef boost::function<void (IEventable&, IEvent&)> behaviorRef;
What is the right way for passing template class IEvent into boost function? With this code I get:
error: functional cast expression list treated as compound expression
error: template argument 1 is invalid
error: invalid type in declaration before ‘;’ token
boost::function needs a type, so you cannot pass it a template's name, it has to be a template instance. So either use a specific instance
typedef boost::function<void (IEventable&, IEvent<SomeEventType>&)> behaviorRef;
or put the whole thing itself into a template:
template< typename EventType >
struct foo {
typedef boost::function<void (IEventable&, IEvent<EventType >&)> behaviorRef;
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With