I am currently trying to create an event template class for my engine.
My event class has an std::Vector<T>
where t
is going to be defined as a pointer to function where the event is needed.
When calling the event it will call every function that was added to the vector with the necessary arguments.
Problem is when trying to compiling this part of the code for calling the event.
At the moment it is written like this.
template <typename... Args>
void Call(Args ... args)
{
for (T f : functions)
{
f->*(args...);
}
}
Note that I have tried :
f->*((args),...);
f->*(std::forward(args)...);
f->*(args)...;
and many others similar solutions.
Every time I tried to compile my code I ran into:
**include/event.h:71:22: error: expected ‘)’ before ‘...’ token
f->*(args...);
^
include/event.h:71:26: error: parameter packs not expanded with ‘...’:
f->*(args...);**
I really don't understand the problem here.
Thanks for any help!
Aucun commentaire:
Enregistrer un commentaire