eating inout dogfood
Steven Schveighoffer
schveiguy at yahoo.com
Fri Oct 14 04:29:40 PDT 2011
On Fri, 14 Oct 2011 04:43:15 -0400, Kagamin <spam at here.lot> wrote:
> Steven Schveighoffer Wrote:
>
>> struct cursor(T)
>> {
>> T* node;
>> void popFront() {node++;}
>> ... // usual suspects front, empty, etc
>> }
>>
>> This seems like cursor!(inout(V)) might work (V is the element type of
>> the
>> container) as the return type for inout functions. However, one of the
>> major requirements of inout is that it correctly cast back to the
>> constancy of the container.
>
> try to return inout(cursor!(Unqual!(V)))
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.
BTW, this assumes V is not const. I'm not exactly sure how well the
containers work when V is not mutable. I'd expect they would fail
spectacularly :)
-Steve
More information about the Digitalmars-d
mailing list