Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some C++ Standard Library usage best practices? [closed]

Tags:

c++

stl

I'm learning C++ and the book I'm reading (The C++ Programming Language) says to not reinvent the wheel, to rely on the standard libraries. In C, I often end up creating a linked list, and link list iteration over and over again (maybe I'm doing that wrong not sure), so the ideas of containers available in C++, and strings, and algorithms really appeal to me. However I have read a little online, and heard some criticisms from my friends and coworkers about STL, so I thought I maybe I'd pick some brains here.

What are some best practices for using STL, and what lessons have you learned about STL?

like image 294
Bjorn Avatar asked Nov 26 '22 22:11

Bjorn


2 Answers

There is a companion book to the Effective C++ series, which is called "Effective STL". It's a good starting point for learning about best practises using the Standard C++ library (neé STL).

like image 56
Timo Geusch Avatar answered Nov 29 '22 12:11

Timo Geusch


You might want to pick up a copy of "Effective C++: 50 Specific Ways to Improve Your Programs and Design (2nd Edition)":

http://www.amazon.com/Effective-Specific-Addison-Wesley-Professional-Computing/dp/0201924889

I've found it to be invaluable, and it's still very relevant today, even if you aren't programming in C++.

like image 26
casperOne Avatar answered Nov 29 '22 13:11

casperOne