null stl iterator ?

Discussion in 'C++' started by Gianni Mariani, Oct 22, 2003.

  1. 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.
     
    Gianni Mariani, Oct 22, 2003
    #1
    1. Advertising

  2. Gianni Mariani

    Moonlit Guest

    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" <> wrote in message
    news:bn69mn$...
    >
    > 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.
    >
    >
     
    Moonlit, Oct 22, 2003
    #2
    1. Advertising

  3. Gianni Mariani

    Ron Natalie Guest

    "Gianni Mariani" <> wrote in message news:bn69mn$...

    > 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.
     
    Ron Natalie, Oct 22, 2003
    #3
  4. Gianni Mariani

    Moonlit Guest

    Hi,

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

    Regards, Ron.

    "Moonlit" <> wrote in message
    news:3f96b6f2$0$58698$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" <> wrote in message
    > news:bn69mn$...
    > >
    > > 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.
    > >
    > >

    >
    >
     
    Moonlit, Oct 22, 2003
    #4
  5. Gianni Mariani

    Ron Natalie Guest

    "Moonlit" <> wrote in message news:3f96c50c$0$58712$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.
     
    Ron Natalie, Oct 22, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Hendrik Maryns
    Replies:
    18
    Views:
    1,458
  2. Replies:
    5
    Views:
    27,276
    Mike Schilling
    Mar 29, 2006
  3. greg
    Replies:
    6
    Views:
    476
    Dietmar Kuehl
    Jul 17, 2003
  4. Replies:
    6
    Views:
    683
    Jim Langston
    Oct 30, 2005
  5. Steven D'Aprano

    What makes an iterator an iterator?

    Steven D'Aprano, Apr 18, 2007, in forum: Python
    Replies:
    28
    Views:
    1,243
    Steven D'Aprano
    Apr 20, 2007
Loading...

Share This Page