ring iterator adaptor for vector interator

P

PengYu.UT

Suppose I want a ring_iterator, which is almost like the
vector::iterator. But it will equals begin(), when it passed the end().
It is easy to write an adaptor for it. But I'm wondering if there is
any publicly available code for it.

Thanks,
Peng
 
D

Daniel T.

Suppose I want a ring_iterator, which is almost like the
vector::iterator. But it will equals begin(), when it passed the end().
It is easy to write an adaptor for it. But I'm wondering if there is
any publicly available code for it.

Do you want begin() == end() + 1, or do you want begin() == end()?
 
R

red floyd

Sorry for the confusion. I want begin() == end().

Not a good idea. No standard algorithms will work in that case.

for (T::iterator iter = c.begin();
iter != c.end();
++iter)
{
// yada yada yada
}

Will not execute any loop iterations.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top