On Monday, 25 April 2016 at 17:52:58 UTC, Andrei Alexandrescu wrote:

Destroy!

Andrei

What about overloaded functions with complex constraints? How would the errors look when none of the overloaded constraints fully match?

auto fun(T)(T t) if (hasWheels!T && canFly!T) {}

auto fun(T)(T t) if (canFloat!T && isAirtight!T) {}

struct A
{
// suppose it has wheels and floats, but can't fly nor is it airtight
}

void main()
{
  A a;
  a.fun(); // `Error: either make A fly or airtight`
}

Reply via email to