Boost logo

Boost :

From: Aristid Breitkreuz (aribrei_at_[hidden])
Date: 2006-09-19 10:45:33

Am Montag, den 18.09.2006, 16:25 +0200 schrieb Nils Springob:
> What would you think of an iterator based approach with the following
> interface:

Iterators are good.

> // Bideirectional iterator for UTF8 / UTF16 coded data
> // I: Raw data iterator
> // C: Unicode character type
> template <class I, typename C> class unicode_iterator;

Fair enough.

> // I: Unicode character iterator
> template <typename I> class unicode_string;

Judging from the code below, this would mean that the iterator
implicitly specifies the internal string type? Something like

        typename iterator_traits<I>::container_type cont;


> // some standard types:
> typedef unicode_iterator<std::string::iterator, wchar_t> utf8_iterator;

You can't assume wchar_t is UTF-32. You can't even assume it's 32 bits.

> typedef unicode_iterator<std::basic_string<short>::iterator, wchar_t>
> utf16_iterator;

You can't assume short is 16-bits (but that's more or less academic).

> typedef std::wstring::iterator utf32_iterator;


Boost list run by bdawes at, gregod at, cpdaniel at, john at