Boost logo

Boost :

Subject: Re: [boost] GSoC 2010: Heaps and Queues
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-04-07 15:21:59


Dan Larkin wrote:
> Andrew Sutton wrote:
> > Not really "internal", just pointer-like. Typically they're used for
> > iterating -- you can tell by the name :) but they're also used in
> > pointer-like ways. Look at the STL list interfaces,
> > especially insert() and erase().
>
> Okay, so once again, focusing on studying for my exam tonight
> right now,
> but just doing a bit of research to get the gears turning in the
> background. Standard iterator functionality requires '++',
> '--', '==',
> 'begin()', and 'end()', correct? Did I miss anything?

It really depends upon the iterator category as to which operations are required. However, you certainly missed the dereferencing operator.

> Other than that, I'm still a confused about the behavior of iterators
> within partially ordered data structures. It's one thing to have a
> pointer abstraction, but traversal seems to be an issue. In
> particular,
> if any changes to the structure are made during the traversal, the
> structure could re-arrange itself in such a way that individual nodes
> could be traversed multiple times before others are visited once,
> without any changes to the node value itself. This seems like poor
> behavior to me, and I'm not sure what to do with it. Perhaps someone
> could shed some light on the issue?

You define which container operations invalidate iterators and its up to clients to avoid those operations while iterating.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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