Traits of variadic templates

Jeff massung at gmail.com
Tue Feb 9 16:32:09 UTC 2021


On Tuesday, 9 February 2021 at 16:25:46 UTC, Paul Backus wrote:
> On Tuesday, 9 February 2021 at 16:22:16 UTC, Jeff wrote:
>> But, those don't work because T is a Tuple of the types. Is 
>> there some trait combination I can use to do this? Something 
>> like (obviously made up)...
>>
>> all(TemplateArgsOf!T, t => isIntegral!t || isSomeString!t)
>>
>> Thanks!
>
> import std.meta: allSatisfy, Or = templateOr;
> allSatisfy!(Or!(isIntegral, isSomeString), T);
>
> http://phobos.dpldocs.info/std.meta.allSatisfy.html
> http://phobos.dpldocs.info/std.meta.templateOr.html

Thanks so much!



More information about the Digitalmars-d-learn mailing list