vendredi 28 juillet 2017

How to declare templated pointer to templated method?

Templated typedefs are possible with using. How can I directly make a templated method pointer?

Example:

class MyClass {

  template<bool B> void fnc() { /*...*/ };

  // Now I can do:
  template<bool B>
  using TempPtr = decltype(&MyClass::fnc<B>);
  //              ^^^^^^^^^^^^^^^^^^^^^^^^^^
};

How can I write the underlined part direcly, without decltype?

So far, I have tried:

template<bool B>
using TempPtr = template<bool> void (MyClass::*)();

template<bool B>
using TempPtr = void (MyClass::*<B>)();

...

Aucun commentaire:

Enregistrer un commentaire