Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Foward iterators

Reply
Thread Tools

Foward iterators

 
 
Dave
Guest
Posts: n/a
 
      05-17-2005
Can anybody offer a specific example of an iterator that has the
capabilities of a forward iterator but no more?


 
Reply With Quote
 
 
 
 
Andrew Koenig
Guest
Posts: n/a
 
      05-17-2005
"Dave" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> Can anybody offer a specific example of an iterator that has the
> capabilities of a forward iterator but no more?


Look at the sequence class in chapter 15 of "Ruminations on C++."

That class offers behavior similar to Lisp lists, but with the restriction
that all elements of a sequence must have the same type. It also has the
interesting property that the container and iterator classes are the same
type.


 
Reply With Quote
 
 
 
 
Howard Hinnant
Guest
Posts: n/a
 
      05-17-2005
In article <(E-Mail Removed)>,
"Dave" <(E-Mail Removed)> wrote:

> Can anybody offer a specific example of an iterator that has the
> capabilities of a forward iterator but no more?


The iterators of a singly linked list are such an example. You can't
iterate backwards (in constant time).

-Howard
 
Reply With Quote
 
Andre Kostur
Guest
Posts: n/a
 
      05-17-2005
Howard Hinnant <(E-Mail Removed)> wrote in news:hinnant-
http://www.velocityreviews.com/forums/(E-Mail Removed):

> In article <(E-Mail Removed)>,
> "Dave" <(E-Mail Removed)> wrote:
>
>> Can anybody offer a specific example of an iterator that has the
>> capabilities of a forward iterator but no more?

>
> The iterators of a singly linked list are such an example. You can't
> iterate backwards (in constant time).
>
> -Howard
>


Or an istream iterator....
 
Reply With Quote
 
Howard Hinnant
Guest
Posts: n/a
 
      05-17-2005
In article <Xns96597434BA43Cnntpspamkosturnet@207.35.177.135> ,
Andre Kostur <(E-Mail Removed)> wrote:

> Howard Hinnant <(E-Mail Removed)> wrote in news:hinnant-
> (E-Mail Removed):
>
> > In article <(E-Mail Removed)>,
> > "Dave" <(E-Mail Removed)> wrote:
> >
> >> Can anybody offer a specific example of an iterator that has the
> >> capabilities of a forward iterator but no more?

> >
> > The iterators of a singly linked list are such an example. You can't
> > iterate backwards (in constant time).
> >
> > -Howard
> >

>
> Or an istream iterator....


Actually not really, at least if we're using the std::definition of
"forward". A std::istream_iterator fails to meet the forward spec
because it can not be used in multi-pass algorithms. The standard terms
iterators in this class as "input iterators" which have a subset of the
functionality of forward iterators.

-Howard
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you set up Voxalot to foward calls to voipcheap.com ? Dave T UK VOIP 4 08-24-2007 10:40 PM
Foward referencing broken? John Watson C++ 5 04-01-2007 09:30 AM
Check this out... modern day honor system, kind of like pay it foward but better adventuresoflinx@hotmail.com C++ 0 05-04-2006 07:46 AM
Iterators and reverse iterators Marcin Kaliciński C++ 1 05-08-2005 09:58 AM
Knife in the Water - Criterion - can't fast foward? Werz Mungle DVD Video 10 10-18-2003 03:08 PM



Advertisments