Simen kjaeraas <[email protected]> wrote:

Simen kjaeraas <[email protected]> wrote:

I've also considered a template on the form

     mixin tailConst!( SimpleRange, SimpleRange!( Tail!T ) );
or
     mixin tailConst!( SimpleRange, Tail!T );

A closer look at this reveals that it won't work that simply, because
SimpleRange in this context is the struct, not the template. This,
however, works:

     mixin tailConst!( .SimpleRange, TailT! );

Not sure how I like this.

After more problems, I have also come to the conclusion that what is
most commonly needed is not really tail-const, but head-mutable. Why
this took me more than a few minutes to consider, I do not know.

Common use-cases would then look like this:

struct MyRange( Range ) {
    HeadMutable!Range r;
    // Range primitives, TailConst support, etc.
}

--
Simen

Attachment: tailconst.d
Description: Binary data

Attachment: tailconst2.d
Description: Binary data

Reply via email to