4 ms·
Deriving Type Erasure
- dalvrosa 7mo agoEver looked at `std::any` and wondered what's going on behind the scenes? Beneath the intimidating interface is a classic technique called type erasure: concrete types hidden behind a small, uniform wrapper. Starting from familiar tools like virtual functions and templates, we'll build a minimal `std::any`. By the end, you'll have a clear understanding of how type erasure works under the hood.
- deleted 7mo ago[deleted]
- Rubio78 7mo agoGreat breakdown of type erasure! It's fascinating how std::any manages to hide concrete types behind a uniform interface, similar to how virtual functions enable polymorphism but with even more flexibility. The shape class example really helps demystify what's happening under the hood.
- dalvrosa 7mo agoThank you, glad that you liked it :)
- alaadeen13 7mo agothanks
- dalvrosa 7mo agoyw!
- Zeeshan1231 7mo ago[flagged]
- dalvrosa 7mo agoWhat?
- christianqchung 7mo agoThanks for writing this. This is unrelated, but one downside of AI being used as an oracle is that I feel like it is/will be less likely to accidentally stumble on an article like this, which clearly explains something I probably never would've asked.
- dalvrosa 7mo agoThanks!