A pattern I'd like to see more of - Parsing template parameter tuples

Ethan gooberman at gmail.com
Mon May 21 09:31:35 UTC 2018


On Monday, 21 May 2018 at 01:53:20 UTC, Manu wrote:
> I don't really like that SomeObject() will be instantiated a 
> crap load of times for every possible combination and order of 
> options that a user might want to supply. How do you control 
> the bloat in a way that people won't mess up frequently?

On Monday, 21 May 2018 at 00:58:10 UTC, Neia Neutuladh wrote:
> These are not the same type; they're two identical types with 
> different mangles.

Yep, entirely something I missed when I did the code. Classic 
"Works For Me!(TM)" moment.

As mentioned by Neia, the thin wrapper would be my preferred way 
of approaching that, at which point your implementation class 
looks like:

class Impl( alias Version, alias Encoding )

There's nothing stopping you doing the proposed std.meta.sort 
either, but that's essentially doubling up on work when you do 
something like what I illustrated.


More information about the Digitalmars-d mailing list