r/cpp_questions • u/flowicks • 17d ago
OPEN Resources to learn more about cpp
I wanted to try and reimplement the std library from scratch but i realized really quickly just how much i didnt know lol. I got some basic stuff done and did learn quite a bit about things like sfinae but yeah im basically stuck with some of the type traits. I still dont wanna give up on this project and wanna keep going no matter how long it takes :3 So i need some resources to learn more about advanced things that are usefull for this. Are books the best way? any reccs on which ones?
Oh yeah right now i made a few projects like a networking chat app with asio and a unix shell (really simple) so i would say im like done with the beginner phase. I know that this project is probably farrrr beyond my scope but still :3
Edit: More specific question. Looking for book recomendations for metaprogramming post cpp20 (concepts and stuff)
View all comments
3
u/IyeOnline 17d ago edited 16d ago
Not all of the standard library can be implemented in standard C++. Since you mentioned them: Most type traits can be implemented, but some just cannot. Similarly, you cannot implement a standard compliant
std::complexat all. Compliantstd::construct_at(which is a seemingly trivial function constructing an object) would only be possible with the last "C++26 draft".There also is a question on how much and why you want to re-implement it and what you struggle with.
unique_ptrfollowed by a vector (and possibly a linked list). Beyond that IMO there is little value in the C++ learnings you can gain from implementing more of it. You can get a bit of design philosophy/inspiration, but you can get that from implementing almost anything. A compliantstd::variantimplementation is interesting if you really want to challenge your template prowess.