For one thing, use the STL. Above all, know your containers (vector
, deque
, list
, map
, set
, etc&c.) and their performance characteristics; and havecharacteristics. Have a solid understanding of where and how to apply even the basics (for_eachaccumulate
, transform
, remove_if
) of the algorithmic primitives defined in the <algorithm>
header. Understand that C++ is a multi-paradigm language, and don'tdon’t try to force everything into the OO model.
If something you'reyou’re doing isn't cleanisn’t plain, legible, and type-safe, chances are you're doing it the C way. Learn the basic standards of type safety, const
correctness, reference semantics, and RAII, all things that subtly but hugelyprofoundly set C++ apart from C. Keep up to date on current developments in the language (type inference with auto
, lambdas, rvalue references) and apply them to improve the clarity and quality of your code.