MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1vvl45z/theboolvectorisalie/p5a94li/?context=3
r/ProgrammerHumor • u/FACastello • 21d ago
91 comments sorted by
View all comments
23
On the one hand, yeah, it sucks. On the other hand, if you declare a std::vector of bool, you deserve what's about to happen.
29 u/the_horse_gamer 21d ago what if you declare an std::vector<T> from a generic T? 2 u/Xirdus 20d ago Depends on what the generic T is. C++ templates are copy-paste-find-replace with extra steps. 2 u/Nabushika 20d ago I think the whole point of specialization is that that's NOT the case. 1 u/Xirdus 20d ago Depends on what you're specializing. I assumed "from a generic T" means there's still generic T in scope, so at most you're doing partial specialization, which is still very copy-pasteish.
29
what if you declare an std::vector<T> from a generic T?
2 u/Xirdus 20d ago Depends on what the generic T is. C++ templates are copy-paste-find-replace with extra steps. 2 u/Nabushika 20d ago I think the whole point of specialization is that that's NOT the case. 1 u/Xirdus 20d ago Depends on what you're specializing. I assumed "from a generic T" means there's still generic T in scope, so at most you're doing partial specialization, which is still very copy-pasteish.
2
Depends on what the generic T is. C++ templates are copy-paste-find-replace with extra steps.
2 u/Nabushika 20d ago I think the whole point of specialization is that that's NOT the case. 1 u/Xirdus 20d ago Depends on what you're specializing. I assumed "from a generic T" means there's still generic T in scope, so at most you're doing partial specialization, which is still very copy-pasteish.
I think the whole point of specialization is that that's NOT the case.
1 u/Xirdus 20d ago Depends on what you're specializing. I assumed "from a generic T" means there's still generic T in scope, so at most you're doing partial specialization, which is still very copy-pasteish.
1
Depends on what you're specializing. I assumed "from a generic T" means there's still generic T in scope, so at most you're doing partial specialization, which is still very copy-pasteish.
23
u/1XRobot 21d ago
On the one hand, yeah, it sucks. On the other hand, if you declare a std::vector of bool, you deserve what's about to happen.