Request for a more powerful template specialization feature

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 14 12:49:05 PDT 2017


On 7/14/17 2:19 PM, data pulverizer wrote:
> template Construct(R: Union{double, int}, W: Union{string, char, dchar})

template Construct(R, W)
if ((is(R == double) || is(R == int))
     && (is(W == string) || is(W == char) || is(W == dchar))

> It would be good to get comments and suggestions before I write a DIP.

An effective way of improving the state of affairs would be to create a 
PR that makes the constraint easier to read and write, e.g.:

among!(R, double, int) && among!(W, string, char, dchar)

In fact it's surprising it hasn't been proposed yet.

Andrei


More information about the Digitalmars-d mailing list