| 1 |
// REQUIRED_ARGS: -o- |
| 2 |
// PERMUTE_ARGS: |
| 3 |
|
| 4 |
template isCallable(T...) |
| 5 |
{ |
| 6 |
static if (is(typeof(& T[0].opCall) == delegate)) |
| 7 |
{ |
| 8 |
enum bool isCallable = true; |
| 9 |
} |
| 10 |
else static if (is(typeof(& T[0].opCall) V : V*) && is(V == function)) |
| 11 |
{ |
| 12 |
enum bool isCallable = true; |
| 13 |
} |
| 14 |
else |
| 15 |
enum bool isCallable = false; |
| 16 |
} |
| 17 |
|
| 18 |
@property auto injectChain(Injectors...)() |
| 19 |
{ |
| 20 |
return &ChainTemplates!(Injectors); |
| 21 |
} |
| 22 |
|
| 23 |
template ChainTemplates(Templates...) |
| 24 |
{ |
| 25 |
alias Head = Templates[0]; |
| 26 |
alias Tail = Templates[1..$]; |
| 27 |
alias Head!(Tail) ChainTemplates; |
| 28 |
} |
| 29 |
|
| 30 |
static assert(!isCallable!(injectChain)); |