Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > null stl iterator ?

Reply
Thread Tools

null stl iterator ?

 
 
Gianni Mariani
Guest
Posts: n/a
 
      10-22-2003

I need to create an object that contains an iterator. The iterator may
or may not be valid in which case I would also need to store a flag
indicating that the iterator is invalid.

Am I missing somthing ?

This object is created way before a container is created so setting it
to end() or somthing does not make sense.


 
Reply With Quote
 
 
 
 
Moonlit
Guest
Posts: n/a
 
      10-22-2003
Hi,

Why not set variables for beginiing end one past end of array.. These var
will be returned by end() and begin().

Then when you assign an array make the 'end' var equal to one past the end
of the array and the other 'begin' var to begining of the array.

Regards, Ron AF Greve

"Gianni Mariani" <(E-Mail Removed)> wrote in message
news:bn69mn$(E-Mail Removed)...
>
> I need to create an object that contains an iterator. The iterator may
> or may not be valid in which case I would also need to store a flag
> indicating that the iterator is invalid.
>
> Am I missing somthing ?
>
> This object is created way before a container is created so setting it
> to end() or somthing does not make sense.
>
>



 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      10-22-2003

"Gianni Mariani" <(E-Mail Removed)> wrote in message news:bn69mn$(E-Mail Removed)...

> This object is created way before a container is created so setting it
> to end() or somthing does not make sense.


Then you will need to have an external flag, or create a container specifically
so you can use it's end() (even if you never put anything in it).

The standard provides no "default" value for iterators.


 
Reply With Quote
 
Moonlit
Guest
Posts: n/a
 
      10-22-2003
Hi,

Forgot to say, initially these variables should be set to zero.

Regards, Ron.

"Moonlit" <(E-Mail Removed)> wrote in message
news:3f96b6f2$0$58698$(E-Mail Removed)4all.nl...
> Hi,
>
> Why not set variables for beginiing end one past end of array.. These var
> will be returned by end() and begin().
>
> Then when you assign an array make the 'end' var equal to one past the end
> of the array and the other 'begin' var to begining of the array.
>
> Regards, Ron AF Greve
>
> "Gianni Mariani" <(E-Mail Removed)> wrote in message
> news:bn69mn$(E-Mail Removed)...
> >
> > I need to create an object that contains an iterator. The iterator may
> > or may not be valid in which case I would also need to store a flag
> > indicating that the iterator is invalid.
> >
> > Am I missing somthing ?
> >
> > This object is created way before a container is created so setting it
> > to end() or somthing does not make sense.
> >
> >

>
>



 
Reply With Quote
 
Ron Natalie
Guest
Posts: n/a
 
      10-22-2003

"Moonlit" <(E-Mail Removed)> wrote in message news:3f96c50c$0$58712$(E-Mail Removed)4all.nl...
> Hi,
>
> Forgot to say, initially these variables should be set to zero.
>

If these "variables" are iterators, then there's no guarantee you can
assign (even a constant) zero to them.


 
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
What makes an iterator an iterator? Steven D'Aprano Python 28 04-20-2007 03:34 AM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
Difference between Java iterator and iterator in Gang of Four Hendrik Maryns Java 18 12-22-2005 05:14 AM
How to convert from std::list<T*>::iterator to std::list<const T*>::iterator? PengYu.UT@gmail.com C++ 6 10-30-2005 03:31 AM
Iterator doubts, Decision on Iterator usage greg C++ 6 07-17-2003 01:26 PM



Advertisments