On 9/8/2016 5:10 AM, Andrei Alexandrescu wrote:
Consider the pattern of overloads:
template foo(T) if (condition!T) { }
template foo(T) if (!condition!T) { }
It makes condition!T a user-facing constraint, which it should not be.
This looks like a nice guideline. Good work. Pushing the roof now. -- Andrei
An example of doing it better, the put() template:
https://github.com/dlang/phobos/blob/master/std/range/primitives.d#L295
Something we need to move away from, the 17 overloads of formatValue() in:
https://github.com/dlang/phobos/blob/master/std/format.d#L1319
all that differ only in the constraint.