I have a collection that is accessible via an iterator. It encodes its data in UTF8. It is much too large (or at least potentially so) to convert all at once so I really need to access it "code-point by code-point" via an iterator.
At the moment all I have available is its default the char-based iterator.
Before I go an write my own iterator adapter can the C++11 std::codecvt_utf8 or bost::utf8_codecvt_facet be used to... oh I don't know magically declare an iterator adapter that does the conversion.
Of course this question is coming from the boost documentation here:
This code was originally written as an iterator adaptor over containers for use with UTF-8 encoded strings in memory. Dietmar Kuehl suggested that it would be better provided as a codecvt facet.
Before this gets closed as a "gimme-the-codz" post I don't really need code (hey if were out there I think google would have found it for me ) just some help in understanding how locals and facits and std::codecvt's are useful in anything other than streams (there are LOTS of examples with streams and if I need the whole collection converted at once that would be awesome! but I need 1 code point at a time... I need iterators -- and hopefully not an iterator that is just a wrapper for a stringstream with a utf8 facet <edit> or did I just answer my own question?<edit>).
This post has been edited by NickDMax: 13 August 2012 - 03:59 PM