"else if" for template constraints

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Aug 17 07:09:51 PDT 2015


On 8/17/15 9:18 AM, Steven Schveighoffer wrote:

> The issue (as I noted in the bug report), is that the array being
> replaced is "some string", and the element type of the stuff to replace
> is a dchar. But the first version is better for replacing a char[] in a
> char[], and works just fine.

I guess this was a slightly wrong opinion. Because the first overload 
uses remove, and remove cannot work with char[] (see phobos 
schizophrenia regarding strings), it must call the always-allocating 
second version.

In any case, the template constraints are still simpler with the new 
style (if(!priorconstraints) && ...)

-Steve


More information about the Digitalmars-d mailing list