How to overload with enum type?
Domain
dont_email at empty.com
Sun Oct 15 08:54:39 UTC 2017
On Sunday, 15 October 2017 at 08:47:42 UTC, Domain wrote:
> void f(int i)
> {
> writeln("i");
> }
>
> void f(E)(E e) if (is(E == enum))
> {
> writeln("e");
> }
>
> enum E { A }
> E e = E.A;
> f(e); // output i
>
> How can I overload with enum type?
I know I can do that with this:
void f(T)(T i) if (is(T == int))
{
writeln("i");
}
But that looks strange.
More information about the Digitalmars-d-learn
mailing list