Boost logo

Boost :

From: Maxim Yegorushkin (e-maxim_at_[hidden])
Date: 2004-09-27 09:14:18

Igor Kholodov <C.JUMP_at_[hidden]> wrote:

>>> Any plans in the future
>>> to add reverse iterator support to const_string?
>>> I wrote some code to work around the absence
>>> of const_reverse_iterator, rbegin(), and rend(),
>>> all of which would be nice to have available.
>> They are there.
> Sorry, I meant to say that existing versions
> of rbegin() and rend() inside const_string template
> class return reverse_iterator, not
> const_reverse_iterator.
> There is a typedef for "reverse_const_iterator", but
> it is not used by any member functions. At the
> same time, std::basic_string<> provides
> const_reverse_iterator, just like all other sequence
> containers.

Well, apart from the fact that the type of resulting iterator of rbegin()
and rend() is chosen without a thought, I see no problem, because
reverse_iterator and reverse_const_iterator actually refer the same type:

     typedef char_type const* iterator;
     typedef char_type const* const_iterator;
     typedef std::reverse_iterator<iterator> reverse_iterator;
     typedef std::reverse_iterator<const_iterator> reverse_const_iterator;

Maxim Yegorushkin

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