jeudi 21 février 2019

Variadic template parameter order problem

I have a templated function wrapper that I am attempting to update to C++11 syntax (variadic paremeters).

My issue is that I am caught in a "catch 22" where 'Args...' must be the last template parameter, but at the same time, cannot be defined after the function pointer template parameter.

Any idea if this can actually be solved?

  template <typename... Args, void(*Function)(Args...)>
  class function
  {
  public:

    void operator ()(Args... args) const
    {
      (*Function)(std::forward<Args...>(args...));
    }
  };

Aucun commentaire:

Enregistrer un commentaire