is(x = module) vs. __traits(isModule, x)
Q. Schroll
qs.il.paperinik at gmail.com
Mon Oct 12 18:22:04 UTC 2020
On Thursday, 8 October 2020 at 14:08:40 UTC, H. S. Teoh wrote:
> On Thu, Oct 08, 2020 at 12:54:49PM +0000, Adam D. Ruppe via
> Digitalmars-d wrote:
>> On Thursday, 8 October 2020 at 10:11:59 UTC, Max Samukha wrote:
>> > Wrapping __traits in templates is a necessity if you want to
>> > use them for anything interesting (such as passing them to
>> > higher order functions):
>>
>> I kinda wish we had a template lambda.
>
> Me too!!! I've been avoiding to use Filter, et al, because I'm
> forced to declare a bunch of helper templates just for trivial
> predicates. If lambda syntax could be extended to templates,
> that would make it much nicer to use.
Analogously to
auto result = range.filter!(function(int i) => i % 1 == 0);
we should make
alias Result = Filter!(template(T) => is(T == Unqual!T), seq);
a thing.
More information about the Digitalmars-d
mailing list