On Sunday, 1 July 2018 at 09:46:55 UTC, Timoses wrote:
Would be nice if std.meta.ApplyLeft did the job here.. Is there
no way of achieving that?
[snip]
Would have to find a way to determine whether Template would
resolve to a function or not. Can't find anything in Traits[1]
or std.traits[2]. Template inspection looks rather limited : /.
It is, but for a fairly good reason. This is perfectly valid D:
template foo(int n) {
static if (n == 0) {
struct foo {}
} else static if (n == 1) {
enum foo = 24;
} else {
void foo() {}
}
}
Given an uninstantiated foo, you can't know if it'll resolve to a
function or not, so I guess some version of the template I wrote
could be added to Phobos as ApplyLeftFn or something.
--
Simen