Re: Is there a more elegant way of testing T for multiple types?

2016-06-18 Thread ag0aep6g via Digitalmars-d-learn
On 06/18/2016 04:37 PM, Gary Willoughby wrote: Here I'm testing T is either a class or interface: void foo(T)(T bar) if (is(T == class) || is(T == interface)) { ... } Is there a more elegant way of testing T for multiple types? Because it doesn't scale well if I need to add more. I would

Is there a more elegant way of testing T for multiple types?

2016-06-18 Thread Gary Willoughby via Digitalmars-d-learn
Here I'm testing T is either a class or interface: void foo(T)(T bar) if (is(T == class) || is(T == interface)) { ... } Is there a more elegant way of testing T for multiple types? Because it doesn't scale well if I need to add more. I would love to use something like this: void foo(T