On my system, wchar_t and int are distinct types with the same properties:
#include <type_traits>
sizeof(wchar_t) == sizeof(int) == 4
std::is_signed<wchar_t> == std::is_signed<int> == std::true_type
std::is_same<wchar_t, int> == std::false_type
In contrast, ptrdiff_t
and long int
are identical types (same properties, and is_same
is true).
Is this distinctness of wchar_t
guaranteed? Is it safe to overload for wchar_t
and int
on all systems? Is there any property in or elsewhere that distinguishes wchar_t
and the corresponding int property besides is_same
?
(System info: I'm interested in the general case, but my tests so far have been on an OS X machine running g++ 4.8.0 and Apple clang++ 4.1, both with -std=c++11.)