Quick A: To allow overloading with the underlying types of uint_least16_t and uint_least32_t
Recently on SO:
If nullptr_t isn't a keyword, why are char16_t and char32_t?
The proposal itself explains why: to allow overloading with the underlying types of
uint_least16_tanduint_least32_t. If they were typedefed this wouldn't be possible.DefineAs for why they aren't in the std namespace, this is for compatibility with the original C proposal. C++ prohibits the C definitions from appearing in its own version ofchar16_tto be a distinct new type, that has the same size and representation asuint_least16_t. Likewise, definechar32_tto be a distinct new type, that has the same size and representation asuint_least32_t.[N1040 defined
char16_tandchar32_tas typedefs touint_least16_tanduint_least32_t, which make overloading on these characters impossible.]<cuchar>[c.strings] / 3
The headers shall not define the typesThe types then would need to be global typedefs, which carries its own set of issues such aschar16_t,char32_t, andwchar_t(2.11).typedef decltype(u'q') char16_t; namespace foo { typedef int char16_t; }The reason for
std::nullptr_tnot being a keyword can be found in the question you linkedWe do not expect to see much direct use ofmakingnullptr_tin real programs.nullptr_tthe real exception here.

Add a Comment
Comments are closed.