December 24, 2020
While working on some code recently, I realised that it's possible for mixin templates to be passed into a templated type, which is then mixed into that type.

e.g.:

```
mixin template T()
{
   void* p;
   ~this(){ freeIfNotNull(p); }
   @disable this(this){}
}

struct S(alias T)
{
   mixin T;
}

alias ST = S!T;
```

I'm starting to find the possible potential of this kind of interesting, and was just wondering if anyone knows any existing uses of passing mixin templates like this, as I'd love to get some ideas flowing.
December 24, 2020
On Thursday, 24 December 2020 at 06:04:45 UTC, SealabJaster wrote:
> I'm starting to find the possible potential of this kind of interesting, and was just wondering if anyone knows any existing uses of passing mixin templates like this, as I'd love to get some ideas flowing.

Are you familiar with CRTP in C++?  It's similar.
https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern

Of course, CRTP itself works in D, too, but I've never seen it used, myself.  Not surprising when mixins, etc., do pretty much the same job, better.