jeudi 30 juin 2016

Nicer syntax for setting default argument value to default constructor

One might want to declare a function with an argument, and specify that the default value for the argument is the result of the type's default constructor:

void foo(a::really::long::type::name arg = a::really::long::type::name());

Is there a nicer syntax for this that doesn't involve entering the type name twice? Something like:

void foo(a::really::long::type::name arg = default);

I realize I can typedef the type name to make it prettier, but I'm curious whether such a syntax exists.

Aucun commentaire:

Enregistrer un commentaire