I have a custom string class that takes a character type and a traits class as template parameters, and I am looking to input/output the string to a std::basic_stream. One of the problem is, my traits class definition is different from the standard traits type, and thus it isn't possible for it to be 100% compatible.
Since the string is allowed to contain a custom transformation format, where a code point could comprise multiple code units, it is possible that the string is a variable-width text encoding. For this reason, I presume that I should output code units, rather than code points. As an example, a terminal that is expecting UTF-8 output would expect a stream of 8bit code units, rather than a 32bit code point.
So, what would anybody suggest for accomplishing this?