C++ Version 14 on g++ and clang; clang warning
Lightweight C++11 library for embedding Unicode
Brought to you by: ijake1111
clang complains with a warning about line 539, which should be changed to
dest[1] = char( 0x80 | ((codepoint >> 18) & 0x3F);
so basically like the following lines.
Both compilers clang++ and g++ compile and link the lib plus the test only with the switch set to C++14, but not with C++11. C++11 lacks rbegin() and rend().
Remark: There is no such thing as a byte order marker (BOM) in UTF-8. UTF-8 was specifically designed to function well disregarding the byte order of the machine. It's one of the major advantages over UTF-16 and UTF-32. Many programs choke on the BOM, therefore it's advisable to never, ever use it.
The Byte Order Mark is e.g. needed to signalize, a certain file is coded in UTF-8 rather than ANSI Charset. You're right, that in principle the BOM should not be necessary by the year 2016. However, for writing out text files that shall be compatible with e.g. Microsoft Office, the BOM is not neglectible.