4 ms·
However the Type Erasure described here doesn't need to know T even when you use it. E.g. it enables things like for (auto x : vec) { x.foo(); }
by aptxkid 5y ago
However the Type Erasure described here doesn't need to know T even when you use it. E.g. it enables things like
for (auto x : vec) {
x.foo();
}
- jhgb 5y agoIs this the thing that's called "Voldemort types" in D?
- LaLaLand122 5y agoAnd if it were in the standard there wouldn't be at least five well known libraries implementing it (including from Adobe and from Facebook): https://github.com/boost-ext/te#similar-libraries https://github.com/boost-ext/te#similar-libraries As far as I know (I don't really follow the committee work) the latest attempt to introduce run-time duck-typing in the standard was https://github.com/andyprowl/virtual-concepts https://github.com/andyprowl/virtual-concepts, which seems dead.
- einpoklum 5y agoAt the link, the library description says: > run-time polymorphism (type erasure) I would argue that it's the first rather than the second.
- einpoklum 5y agoThat's because it's not type-erasure; it's essentially access through a base class pointer with some sugar on top so that it doesn't look like `x->foo()`.