Re: Primary Ranges of Containers

2012-06-20 Thread Andrei Alexandrescu
On 6/20/12 11:03 AM, Jonathan M Davis wrote: On Wednesday, June 20, 2012 13:38:31 Timon Gehr wrote: Escape the payload anyway and document that the range is invalid after the container has been destroyed. That's a given anyway. Ranges from containers are _always_ invalid after the container th

Re: Primary Ranges of Containers

2012-06-20 Thread Timon Gehr
On 06/20/2012 06:03 PM, Jonathan M Davis wrote: On Wednesday, June 20, 2012 13:38:31 Timon Gehr wrote: Escape the payload anyway and document that the range is invalid after the container has been destroyed. That's a given anyway. Ranges from containers are _always_ invalid after the container

Re: Primary Ranges of Containers

2012-06-20 Thread Jonathan M Davis
On Wednesday, June 20, 2012 13:38:31 Timon Gehr wrote: > Escape the payload anyway and document that the range is invalid after > the container has been destroyed. That's a given anyway. Ranges from containers are _always_ invalid after the container that they come from is gone. They can also bec

Re: Primary Ranges of Containers

2012-06-20 Thread Timon Gehr
On 06/20/2012 12:29 PM, Matthias Walter wrote: On 06/19/2012 04:04 PM, Timon Gehr wrote: On 06/19/2012 02:54 PM, Christophe Travert wrote: Jonathan M Davis , dans le message (digitalmars.D:170054), a écrit : I'd propose to always add a bool template parameter (maybe isConst?) to the range sinc

Re: Primary Ranges of Containers

2012-06-20 Thread Matthias Walter
On 06/19/2012 04:04 PM, Timon Gehr wrote: > On 06/19/2012 02:54 PM, Christophe Travert wrote: >> Jonathan M Davis , dans le message (digitalmars.D:170054), a écrit : I'd propose to always add a bool template parameter (maybe isConst?) to the range since most of the write-functionality can

Re: Primary Ranges of Containers

2012-06-19 Thread Timon Gehr
On 06/19/2012 02:54 PM, Christophe Travert wrote: Jonathan M Davis , dans le message (digitalmars.D:170054), a écrit : I'd propose to always add a bool template parameter (maybe isConst?) to the range since most of the write-functionality can be "removed" by a static if statement in order to mak

Re: Primary Ranges of Containers

2012-06-19 Thread Christophe Travert
Jonathan M Davis , dans le message (digitalmars.D:170054), a écrit : >> I'd propose to always add a bool template parameter (maybe isConst?) to >> the range since most of the write-functionality can be "removed" by a >> static if statement in order to make the range read-only. >> >> Any suggestion

Re: Primary Ranges of Containers

2012-06-18 Thread Matthias Walter
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/18/2012 01:08 PM, Jonathan M Davis wrote: > On Monday, June 18, 2012 10:06:44 Matthias Walter wrote: >> Hi, >> >> last week I realized that a const version of >> std.container.Array.opSlice() is missing. Now I looked at the >> code and I think

Re: Primary Ranges of Containers

2012-06-18 Thread Jonathan M Davis
On Monday, June 18, 2012 10:06:44 Matthias Walter wrote: > Hi, > > last week I realized that a const version of > std.container.Array.opSlice() is missing. Now I looked at the code and I > think that it is a general design problem. > > The docs state that "c.Range" is "The primary range type asso

Primary Ranges of Containers

2012-06-18 Thread Matthias Walter
Hi, last week I realized that a const version of std.container.Array.opSlice() is missing. Now I looked at the code and I think that it is a general design problem. The docs state that "c.Range" is "The primary range type associated with the container.". I think we really always need two Range ty