I have written a typedef like the following:
typedef wchar_t *cString;
and I put the const keyword independently as follow:
void func(const cString)
But when passing wstring::c_str()
to the previous method func(wstring::c_str())
, it tells me there's an error argument of type "const wchar_t *" is incompatible with parameter of type "cString"
, although the type cString
is wchar_t *
with an independent const
.
and to resolve that problem I must either define the typedef as typedef const wchar_t *cString;
or use const wchar_t*
directly without typedef.
Why that problem occurred?