Parameters declared as the alias of a template won't accept the arguments of the same type.

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue May 3 07:11:48 UTC 2022


On Tuesday, 3 May 2022 at 06:20:53 UTC, Elfstone wrote:
> Yeah, I understand some cases are impossible, and to be 
> avoided. I believe your example is also impossible in C++, but 
> it's better the compiler do its job when it's totally possible 
> - needless to say, C++ compilers can deduce my _dot_.
> Constraints/Concepts are useful, but what's needed here is a 
> literal _alias_. There's no ambiguity, no extra template 
> parameters introduced in the declaration.

I haven't read all of the posts in this thread, but D in general 
doesn't do proper type unification so template composition in D 
is not as useful as in C++. It is discussed here:

https://forum.dlang.org/post/rt26mu$2c6q$1@digitalmars.com

As you see, someone will have to write a DIP to fix this bug, as 
the language authors don't consider it a bug, but an enhancement.

I've never got around to do it myself, but if you or someone else 
write the DIP, then I would like to help out with the wording if 
needed.



More information about the Digitalmars-d-learn mailing list