eating inout dogfood

Kagamin spam at here.lot
Sun Oct 16 08:48:42 PDT 2011


Steven Schveighoffer Wrote:

> On Fri, 14 Oct 2011 09:02:04 -0400, Kagamin <spam at here.lot> wrote:
> 
> > Steven Schveighoffer Wrote:
> >
> >> This won't solve the problem.  I need inout to be on V, not on the
> >> cursor.  Essentially, I need cursor to be tail-inout.
> >
> > Since const is transitive, constness of cursor eventually propagates to  
> > V.
> 
> I think you misunderstand the problem.  I need constness to be applied to  
> the V, but *NOT* to the cursor.  If constness is applied to the cursor,  
> it's not iterable (i.e. popFront does not work).

the cursor can provide a method, say, dup, which would return it's mutable copy, properly templated on const.

foreach(v; dic.values) // doesn't compile?
foreach(v; dic.values.dup()) // should work


More information about the Digitalmars-d mailing list