mardi 18 décembre 2018

Ommit empty <> in C++ templates

Is there a way to omit an empty <> in C++11 to make the syntax nicer, meaning writing Foo instead of Foo<> for a template class.

Full example:

template<int N = 1>
class Foo{};

using Foo = Foo<>;
int main()
{
  Foo foo; // I want to be able to write this.
  Foo<> foo; // Works but is ugly.
}

Aucun commentaire:

Enregistrer un commentaire