为什么Visual C ++ 2017实现std :: codecvt_utf8_utf16<> :: do_max_length()会返回6(假设codecvt_mode为0)?
// CLASS codecvt_utf8_utf16
template<class _Elem,
unsigned long _Mymax = 0x10ffff,
codecvt_mode _Mymode = (codecvt_mode)0>
class codecvt_utf8_utf16
: public codecvt<_Elem, char, _Statype>
{ // facet for converting between UTF-16 _Elem and UTF-8 byte sequences
// ...
virtual int __CLR_OR_THIS_CALL do_max_length() const _THROW0()
{ // return maximum length required for a conversion
return ((_Mymode & consume_header) != 0 ? 9 // header + max input
: (_Mymode & generate_header) != 0 ? 7 // header + max output
: 6); // 6-byte max input sequence, no 3-byte header
}
不应该是4(要编码UTF-8中的任何Unicode代码点,最多需要4个字节)?