2 ms·
For what purpose would you need to wrap everything in a template class? In my work, I've only touched templates a couple of times in years. They're useful, but
by Night_Thastus 4y ago
For what purpose would you need to wrap everything in a template class? In my work, I've only touched templates a couple of times in years. They're useful, but I don't see how it's always needed.
- ben-schaaf 4y agostd::unique_ptr and std::shared_ptr are templated wrapper classes.
- Night_Thastus 4y agoOh. I misunderstood. I was thinking of user-made templates, not the built-in ones from the standard library. I don't see the issue though. Something like vector feels intuitive. I have a vector<int> or a vector<myType> etc. A pointer to an int, a unique_ptr<int>. It's convenient and fairly flexible. I don't really see the downside, or how it could be done better given static typing.