Need for std.meta.isSame over __traits(isSame)

Per Nordlöw per.nordlow at gmail.com
Wed Sep 1 23:04:18 UTC 2021


On Wednesday, 1 September 2021 at 22:51:40 UTC, Per Nordlöw wrote:
> Can somebody explain the need for

Ok, `__traits(isSame)` always returns false for values.

This is very unfortunate as `std.traits.isSame` is one of the 
most used template instances in typical std.meta-programming and 
has a noticeable impact on time and space complexity now that 
AliasAssign-enabled versions of std.meta members have removed the 
need for other costly recursive template patterns.

I suggest we add a new builtin trait that exactly mimics 
std.traits.isSame or inline the calls to `isSame` in 
`std.traits.meta`. This is gonna significantly speed up functions 
in std.meta, for instance `staticIndexOf`, `EraseAll`, 
`GenericReplace`, `ReplaceAll`, `Pack`.


More information about the Digitalmars-d-learn mailing list