To be more precise, Tobias, my PApply!() would allow you to define your predicate »unnested«, i.e. just as a template with two parameters and then do StaticFilter!(PApply(IsEqual, 5), …).

But yes, not being able to »chain« template instantiation is quite a limitation of the D grammar when it comes to »higher-order templates« (at least that's what I like to call them). In some situations, you have no other options than to define an Instantiate!() template, see e.g. the Gist I posted.

David


On 11/11/11 6:25 PM, David Nadlinger wrote:
On 11/11/11 6:20 PM, Timon Gehr wrote:
This is a sketch of how I would approach your problem. The "Curry"
template automatically creates the nested template version from an
unnested one. You are then allowed to use both IsEqual!(val) and
IsEqual!(val1, val2).
[…]

See also: https://gist.github.com/1191885#L27

Reminds me that I really have to put together a std.meta proposal – if I
would only find time to do so…

David

Reply via email to