Boost logo

Boost :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2004-04-14 21:37:04


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.

For the constructor, you give a pair of iterators and an optional offset,
which defaults to 0. I think this covers all uses.

Since the realposition can easily exceed an int, I decided to make this a
separate parameter "offset_t" which defaults to int.

Included is the iterator, a Ring class based on it, and a small test.






Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk