Defining inout returned values for ranges

2013-09-03 Thread Jonathan Crapuchettes
If a range struct (Range) is defined inside another struct (Test), how can the constness or mutability of Test be attributed to the return type of Range.front? I'm running into this problem because I need the range to be iterated, but I need the pointer in T to be marked const when appropriate.

Re: Defining inout returned values for ranges

2013-09-04 Thread anonymous
On Wednesday, 4 September 2013 at 00:56:39 UTC, Jonathan Crapuchettes wrote: If a range struct (Range) is defined inside another struct (Test), how can the constness or mutability of Test be attributed to the return type of Range.front? I'm running into this problem because I need the range to

Re: Defining inout returned values for ranges

2013-09-05 Thread Jonathan Crapuchettes
On Wed, 04 Sep 2013 11:49:41 +0200, anonymous wrote: > On Wednesday, 4 September 2013 at 00:56:39 UTC, Jonathan Crapuchettes > wrote: >> If a range struct (Range) is defined inside another struct (Test), how >> can the constness or mutability of Test be attributed to the return >> type of Range.fr

Re: Defining inout returned values for ranges

2013-09-05 Thread anonymous
On Thursday, 5 September 2013 at 19:19:42 UTC, Jonathan Crapuchettes wrote: On Wed, 04 Sep 2013 11:49:41 +0200, anonymous wrote: [...] You can use a Template This Parameter [1] instead of inout: auto opSlice(this This)() { static if(is(This == const)) alias QualifiedT = con

Re: Defining inout returned values for ranges

2013-09-06 Thread Jonathan Crapuchettes
On Thu, 05 Sep 2013 23:32:10 +0200, anonymous wrote: > On Thursday, 5 September 2013 at 19:19:42 UTC, Jonathan Crapuchettes > wrote: >> On Wed, 04 Sep 2013 11:49:41 +0200, anonymous wrote: > [...] >>> You can use a Template This Parameter [1] instead of inout: >>> >>> auto opSlice(this Th