A pattern I'd like to see more of - Parsing template parameter tuples
Paul Backus
snarwin at gmail.com
Mon May 21 03:30:37 UTC 2018
On Monday, 21 May 2018 at 00:13:26 UTC, Ethan wrote:
> But the functions, they're a bit trickier. So I made a new
> trait in Binderoo's traits module called ExtractTupleOf. The
> template prototype is the following:
>
> template ExtractTupleOf( alias TestTemplate, Symbols... )
>
> That first parameter is the interesting one. It's essentially
> an uninstantiated template that doubles as a lambda. The
> template is expected to be an eponymous template aliasing to a
> boolean value, and take one parameter (although, theoretically,
> a CTFE bool function(T)() would also work). ExtractTupleOf will
> static foreach over each symbol in Symbols, and static if(
> TestTemplate!Symbol ) each one. If it returns true, then that
> symbol is extracted and put in a new tuple.
Am I missing something, or is this the same thing as `std.meta:
Filter`?
More information about the Digitalmars-d
mailing list