On Tuesday, 17 August 2021 at 18:11:56 UTC, james.p.leblanc wrote:
Is there a more elegant way, to do this?

Regards,
James

PS Any violations should be caught at compile time.

That is template specialization:

```
auto moo(T : YourSpecialClassOrDType)(T myMoo) {•••}
```

You can also declare other overloads of the method, just make sure they don't overlap in the constraints, otherwise you'd get ambiguous call exception.

Regards,
Alexandru.

Reply via email to