Re: to invalidate a range

2011-08-15 Thread Steven Schveighoffer
On Fri, 12 Aug 2011 18:29:00 -0400, Ellery Newcomer wrote: On 08/12/2011 03:54 PM, Jonathan M Davis wrote: In the case of container that uses nodes - such as a linked list - because you can add and remove elements without affecting other elements, iterators and ranges don't tend to get

Re: to invalidate a range

2011-08-15 Thread Steven Schveighoffer
On Fri, 12 Aug 2011 16:58:15 -0400, Ellery Newcomer wrote: On 08/12/2011 03:29 PM, Steven Schveighoffer wrote: On Fri, 12 Aug 2011 15:54:53 -0400, Ellery Newcomer wrote: in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers.

Re: to invalidate a range

2011-08-12 Thread Jonathan M Davis
On Friday, August 12, 2011 20:03:59 Ellery Newcomer wrote: > On 08/12/2011 06:34 PM, Jonathan M Davis wrote: > >> Forgive my being dense, but where is this 'as long as' coming from? If > >> your range only points to ends in e.g. a linked list, how is it > >> supposed > >> to retrieve elements in th

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 06:34 PM, Jonathan M Davis wrote: Forgive my being dense, but where is this 'as long as' coming from? If your range only points to ends in e.g. a linked list, how is it supposed to retrieve elements in the middle? I'm having a hard time visualizing a range over a node based contain

Re: to invalidate a range

2011-08-12 Thread Jonathan M Davis
On Friday, August 12, 2011 16:16 Ellery Newcomer wrote: > On 08/12/2011 05:51 PM, Jonathan M Davis wrote: > > An implementation can guarantee it as long as your range doesn't directly > > point to an element being removed (i.e. as long as the element isn't on > > the ends - or maybe one past the en

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 05:51 PM, Jonathan M Davis wrote: An implementation can guarantee it as long as your range doesn't directly point to an element being removed (i.e. as long as the element isn't on the ends - or maybe one past the end, depending on the implementation). But _no_ container can guarant

Re: to invalidate a range

2011-08-12 Thread Jonathan M Davis
On Friday, August 12, 2011 15:29 Ellery Newcomer wrote: > On 08/12/2011 03:54 PM, Jonathan M Davis wrote: > > In the case of container that uses nodes - such as a linked list - > > because you can add and remove elements without affecting other > > elements, iterators and ranges don't tend to get i

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 03:54 PM, Jonathan M Davis wrote: In the case of container that uses nodes - such as a linked list - because you can add and remove elements without affecting other elements, iterators and ranges don't tend to get invalidated as easily. As long as you don't remove the element (or e

Re: to invalidate a range

2011-08-12 Thread Jonathan M Davis
On Friday, August 12, 2011 13:58 Ellery Newcomer wrote: > On 08/12/2011 03:29 PM, Steven Schveighoffer wrote: > > On Fri, 12 Aug 2011 15:54:53 -0400, Ellery Newcomer > > > > wrote: > >> in std.container, the stable* container functions advocate that they > >> do not invalidate the ranges of their

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 03:29 PM, Steven Schveighoffer wrote: On Fri, 12 Aug 2011 15:54:53 -0400, Ellery Newcomer wrote: in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers. What does it mean to invalidate a range? Say for example, you

Re: to invalidate a range

2011-08-12 Thread Jonathan M Davis
On Friday, August 12, 2011 12:54 Ellery Newcomer wrote: > in std.container, the stable* container functions advocate that they do > not invalidate the ranges of their containers. What does it mean to > invalidate a range? > > my assumption is it means causing e.g. front or popFront to fail when >

Re: to invalidate a range

2011-08-12 Thread Steven Schveighoffer
On Fri, 12 Aug 2011 15:54:53 -0400, Ellery Newcomer wrote: in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers. What does it mean to invalidate a range? Say for example, you are iterating a red black tree, and your current

Re: to invalidate a range

2011-08-12 Thread Ellery Newcomer
On 08/12/2011 03:13 PM, bearophile wrote: Ellery Newcomer: in std.container, the stable* container functions advocate that they do not invalidate the ranges of their containers. What does it mean to invalidate a range? Generally modifying a collection while you iterate on it causes troubles.

Re: to invalidate a range

2011-08-12 Thread bearophile
Ellery Newcomer: > in std.container, the stable* container functions advocate that they do > not invalidate the ranges of their containers. What does it mean to > invalidate a range? Generally modifying a collection while you iterate on it causes troubles. When you iterate on a range and you m