Recursively defined matcher function

sighoya sighoya at gmail.com
Sun Jan 3 19:26:43 UTC 2021


On Sunday, 3 January 2021 at 18:55:58 UTC, sighoya wrote:
>```
>alias matcherSignature(T:matcherSignature!T) = Matcher (T[]  
>matchers...);
>```

Yet, it is right:

```
alias matcherSignature(T:matcherSignature!T) = Matcher 
function(T[]  matchers...);
```

But it didn't work likewise, you have to instantiate it 
infinitely in nesting order.

I think you either need some kind of nominalism to state 
matcherSignature!T exists for any T or you need to end it after a 
certain depth:

```
struct theEnd {}

template matcherSignature(T) if (T==matcherSignature!T || 
T==theEnd)
{
     Matcher function(T[] matchers...) fp;
}
```



More information about the Digitalmars-d-learn mailing list