Boost logo

Boost :

From: Nir Arad (narad_at_[hidden])
Date: 2001-02-28 13:03:20


Hi,

In fact, I'm coming to realize that what I need is more of a "circular buffer"...
I actually want a sort of "round robin" mechanism which iterates over the set many times.
Adding the "if (it == v.end())" in every iterator advancement seems an overhead to me,
since in this case I would simply want to move on to v.begin(), and not terminate my code.

The point in a circular buffer seems to me the fact that the last node points to the first,
discarding the need to check at every advancement.

Thanks for all the replies,

Nir Arad
Switching Product Group
Galileo Technology

Email mailto:narad_at_[hidden]

Tel - + 972 4 8225046 ext. 426
FAX - + 972 4 8326420

Moshav Manof, D.N. Misgav 20184, ISRAEL
http://www.galileoT.com

----- Original Message -----
From: "Craig Hicks" <hicks_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 28, 2001 5:32 AM
Subject: Re: [boost] Cyclic iterators

If you are really iterating over and over a fixed size container, and speed
is important, you probably want to set up a
vector of copies, or a vector of pointers at the start to cut down access
time.

Then you can use vec[n % isize] to get what you want.
But this has little to do with STL, I realize.

Craig Hicks

----- Original Message -----
From: <narad_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, February 28, 2001 12:57 AM
Subject: [boost] Cyclic iterators

> Hi,
>
> I would like to iterate over a container again and again (a vector,
> list or set). I would like to simply increment the iterator all the
> time, without having to check if I reached the end().
>
> Any ideas on implementing this? Anyone done that before?
>
> Thanks,
> Nir Arad.
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


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