
On 14/02/11 18:36, Germán Diago wrote:
With constexpr + user-defined literals, I think this can be done:
template <char...C> struct Var_Name { //expand here C... };
And with user-defined literals:
constexpr template <char... C> Var_Name<C...> operator _var();
now:
//We didn't loose the name!!!! Good c++0x... typedef tuple<Var_Name<"name"_var>...
This should be valid c++0x.
Alas, I think not. In my reading of the standard (N3092, [lex.ext]), only integer literals and floating point literals support the literal operator template form (which is what you're trying to use here); for string literals you only get the form operator "" X(char*, size_t); which is no good for compile-time lookup because it doesn't give compile-time access to the chars. Hoping I'm wrong, John Bytheway