Adam wrote:
> [...]
> It is no longer relevant to this particular problem, but I am curious
> as to why the following worked:
>
> typedef char* Char;
> template<> void foo<Char>::f(const Char& param);
>
> How is 'const Char &' different from 'const char* &' in this case? I'm
> guessing that 'Char' is now seen only as a pointer, and that 'const
> Char' is equivalent to 'Char const'. Is that correct?
Absolutely. You always should position the 'const' specifier to the right
of the type-id. In case of 'char*', the type-id is 'char', so the 'const'
moves between 'char' and '*'. In case of 'Char', the type-id is 'Char',
so the 'const' skips to the right. Once expanded again, it becomes this
peculiar thing 'char * const', which is not the same as 'char const *'.
It's not the clearest part of the language, but once you learn it, it will
serve you well.
V
|