|
Boost : |
From: Roland Richter (roland_at_[hidden])
Date: 2004-04-30 02:34:19
Neal Becker wrote:
> I like your suggestion, Roland. Here is my adaptation (I will have to add
> credits and copyright later).
>
> It counts wraps as you suggest. I found it easier to implement and
> understand by basing it on an integral offset from a base. It all becomes
> pretty simple by calculating a "realposition" which is wraps*size+position.
> This is like a virtual index into an infinitely long sequence.
>
Definitely, this solution is elegant and better readable. Plus, it
passes the test I use for cyclic_iterator (in the sandbox) after
a minor modification:
For unknown reason, MSVC chokes on
typename std::iterator_traits<BaseIterator>::value_type
twice ('iterator_category' : is not a member of 'operator``global amespace'''),
but accepts
typename boost::iterator_value<BaseIterator>::type
I suggest to add your implementation to Boost.Iterator! Does this
require a review, or mini review, if there is something like that?
- Roland
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk