My template tuple code does not compile
Simen Kjærås
simen.kjaras at gmail.com
Wed Feb 27 08:31:29 UTC 2019
On Wednesday, 27 February 2019 at 03:53:35 UTC, Victor Porton
wrote:
> After following your suggestion to rewrite it with Stride it
> does not work either. I assume the error is somehow related to
> allSatisfy!.
>
> https://github.com/vporton/struct-params-dlang/blob/c1adc86672f46fd6b743903cc270dceef120a8fe/source/struct_params.d
>
> Please help. It is important for both D community and world at
> large.
Your problem is exactly here:
allSatisfy!(x => is(typeof(x) == string), Names)
allSatisfy expects its first parameter to be a template, not a
function. We can introduce a simple helper template:
template isA(T) {
enum isA(alias U) = is(typeof(T) == U);
}
Then simply replace the code above with allSatisfy!(isA!string,
Names).
--
Simen
More information about the Digitalmars-d-learn
mailing list