According to the standard, a conversion function has a function-id operator conversion-type-id, which would look like, say, operator char(&)[4] I believe. But I cannot figure out where to put the function parameter list. gcc does not accept either of operator char(&())[4] or operator char(&)[4]() or anything I can think of.
Now, gcc seems to accept (&operator char ())[4] but clang does not, and I am inclined to not either, since it does not seem to fit the grammar as I understand it.
I do not want to use a typedef because I want to avoid polluting the namespace with it.
You can use identity
You are correct that function and array declarators won’t work in conversion functions. This is also known and discussed in this issue report. However i think that C++0x already provides a solution to what they discuss there
Unlike the
identityandtypedefapproach, this allowsTandNto be deduced, i think.