Yes, wchar_t
is guaranteed to be a distinct type (§3.9.1/5):
Type
wchar_t
is a distinct type whose values can represent distinct codes for all members of the largest extended character set specified among the supported locales (22.3.1).
So yes, it's safe to overload for wchar_t
and int
on all systems.
However, wchar_t
is also guaranteed to have the same size, signedness and alignment requirements as another integral type, which is its underlying type. This isn't necessarily int
but in your case appears to be. This means wchar_t
is probably implemented using one of the integral types, but as far as you are concerned, they are treated as completely distinct types.