3 ms·
I disagree. Avoid native arrays; only use them when absolutely necessary. They are error prone and primitive. The STL data structures and algorithms are powerfu
by scott_s 19y ago
I disagree. Avoid native arrays; only use them when absolutely necessary. They are error prone and primitive. The STL data structures and algorithms are powerful, and are the best way to write a small amount of code that accomplishes a lot. What you're suggesting will result in complicated, buggy code to achieve simple tasks.
Getting all of the details of the STL right is tricky and takes time, but using the simplest features is still the fastest way to write good C++ code. Since he already knows Python, it's mostly a matter of mapping the concepts from one language to another.
I can't stress this enough. If you find yourself thinking, "Hmmmm, I need a list of these," use std::list. If you find yourself thinking "Hmmm, I need a structure that maps these values to those values," use std::map.
When learning a new language, I think it's best to start using that language's idioms right away. C++ is no exception.