Does `is` expression with template alias need fixing.

Elfstone elfstone at yeah.net
Thu Mar 23 00:36:12 UTC 2023


On Wednesday, 22 March 2023 at 12:30:46 UTC, FeepingCreature 
wrote:

> You cannot *constrain a type to be Vector3* in D

That's the problem.

> you cannot in C++ either.

Yes, I can.

```C++
template <typename T>
using Vector3 = Matrix<T, 3, 1>;

template <typename T>
void foo(const Vector3<T>& v) {
}

int main() {
	foo(Vector3<float>());
}
```
I can declare parameters with Vector3\<T\>, and it gets me the 
right T, which is all I need.

D allows me to declare template alias parameter but it matches 
nothing at all. Then why allow people to write template alias 
parameters at all?



More information about the Digitalmars-d mailing list