samedi 21 janvier 2017

User defined literals definitions

I was taking a look at the cppreference page for user defined literals, and I think I understand everything except a few examples

template <char...> double operator "" _π(); // OK

How does this operator work? How can you call it?

double operator"" _Z(long double); // error: all names that begin with underscore
                                   // followed by uppercase letter are reserved
double operator""_Z(long double); // OK: even though _Z is reserved ""_Z is allowed

What is the difference between the above two functions? What would be the difference in calling the first function as opposed to the second if the first were not an error?

Thanks!

Aucun commentaire:

Enregistrer un commentaire