mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
30 lines
621 B
D
30 lines
621 B
D
// REQUIRED_ARGS: -o-
|
|
// PERMUTE_ARGS:
|
|
|
|
template isCallable(T...)
|
|
{
|
|
static if (is(typeof(& T[0].opCall) == delegate))
|
|
{
|
|
enum bool isCallable = true;
|
|
}
|
|
else static if (is(typeof(& T[0].opCall) V : V*) && is(V == function))
|
|
{
|
|
enum bool isCallable = true;
|
|
}
|
|
else
|
|
enum bool isCallable = false;
|
|
}
|
|
|
|
@property auto injectChain(Injectors...)()
|
|
{
|
|
return &ChainTemplates!(Injectors);
|
|
}
|
|
|
|
template ChainTemplates(Templates...)
|
|
{
|
|
alias Head = Templates[0];
|
|
alias Tail = Templates[1..$];
|
|
alias Head!(Tail) ChainTemplates;
|
|
}
|
|
|
|
static assert(!isCallable!(injectChain));
|