#10 in Microsoft programming books
Use arrows to jump to the previous/next product
Reddit mentions of Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library
Sentiment score: 9
Reddit mentions: 13
We found 13 Reddit mentions of Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library. Here are the top ones.
Buying options
View on Amazon.comor
Specs:
Height | 9.1 Inches |
Length | 7.3 Inches |
Number of items | 1 |
Weight | 1.29190885532 Pounds |
Width | 0.8 Inches |
I guess I'm going to go ahead and be "that guy".
Don't aim to work with a specific language.
I feel you should reframe your goal to be a "problem solver" that knows how to pick and use various tools to solve a problem. C++ may be one of those tools. Maybe C. Maybe Python. Maybe Java. You want to develop your skill set to be flexible enough to adopt the right tool for a job. Now, that's not to say you can't be a language expert. Language experts are very valuable and becoming one is a perfectly reasonable goal. That said, I think you'll find that you have many more opportunities when you remain flexible.
With that out of the way, I would say good next steps for continued C++ mastery are to read and understand Scott Meyers' excellent books:
Also go through the CppCoreGuidelines.
Beyond the language, make sure you know your standard data structures and algorithms.
There is also "Effective STL" if you're a big STL user.
Basic:
C++ Primer
Effective C++
Effective STL
Advanced:
More Effective C++
C++ Coding Standards: 101 Rules
C++ Templates The Complete Guide
Large Scale C++ Design
If you're serious about C++ programming and using the STL intelligently, I highly recommend getting a copy of Scott Meyers' Effective STL. He discusses exactly what you're asking about, e.g. when is a
std::list
better (or worse) than astd::vector
, or how is astd::vector<bool>
different than astd::bitset
.Actually all three of his books (Effective C++ and More Effective C++) are great reading if you haven't done so.
As for your question, if you need a thing to hold an array of something,
std::vector
is usually the go-to container for that.The correct answer to:
Q. Should I learn C or C++ first?
Is:
A. Yes.
WARNING: Highly Opinionated Analysis of C vs C++
I see a lot of people recommending one way but no one offering an analysis of BOTH the Pro's & Con's.
I've been using C++ since ~1990. I've briefly worked on a PS3 C++ compiler when I worked for Sony. I've seen 2 major problems over the years with C++ programmers:
1. People don't exercise discipline and restraint in K.I.S.S.
They use (and abuse) every language feature because they can. There is this tendency to over-engineer even the simplest things. Take a look at this complete clusterfuck of CRC in the Boost library.
1109 lines of over-engineered C++ crap for a simple CRC32 function instead of a mere 25 lines of code!?!?! The C version would:
The trade-off would be is that it is less flexible, but WHEN was the last time you needed to use a custom CRC polynomial!?!? One would instead use a different algorithm such as MD5, SHA, etc. that:
This excellent SO on hashing is but one example of focusing on the big picture.
2. People lack a basic understanding of the cost let alone the implementation of C++ expressions.
I've seen people stick a virtual function inside an inner loop and wonder why their performance is crap. I've seen people fail to grasp a basic understanding of pointers. I've seen people not understand memory management and how to guarantee zero memory leaks. I've seen people spend more time on writing an "über" template and waste hours debugging that instead of just writing something in 1/10 of the time and move on.
IMO, due to the bloated, over-excessive verbose nature of C++ it is for these reason that I strongly recommend a beginner learn C first and then learn C++. You'll have a better understanding of why C++ is designed the way it is, what the design trade-offs are/were, what C++ hacks are, and how to best use the languages to their potential.
However, this is ignoring the benefits and disadvantages of the Pro's/Con's of why one would learn C++ or C first.
Learn C++ first
Learn C first
{
{
With that said there are numerous C++ books I would recommend to ALL C++ programmers. They are sorted from beginner to expert:
If you can get only one book, get the The C++ Programming Language.
Even though Bruce's book is ancient he keeps it simple and is a fun easy read. Remember this is before C++98 where the language is much simpler.
You can find it online for free
Lastly, just because you can, doesn't imply you should. Use balanced C++ and you'll be fine.
If you haven't read these books already, what are you doing, go and read them now.
Effective C++
More Effective C++
Effective STL
Effective Modern C++
Effective C++
More Effective C++
and Effective STL
These are books I read many years ago, they can be helpful but may be dated and will not include newer features. But as an introduction they worked well.
Thinking in C++ Voume 1 and 2 by Bruce Eckel
https://www.amazon.com/Thinking-Vol-Introduction-Standard-2nd/dp/0139798099/ref=dp_ob_title_bk
https://www.amazon.com/Thinking-C-2-Practical-Programming/dp/0130353132/ref=pd_sbs_14_1
And Scott Meyers
Effective C++ - https://www.amazon.com/Effective-Specific-Improve-Programs-Designs/dp/0321334876/ref=pd_sbs_14_2
Effective STL - https://www.amazon.com/Effective-STL-Specific-Standard-Template/dp/0201749629
The assembly is rather light at the beginning. In your first year you have to write some assembly to control a little car with infrared sensors, but it's really easy. Later on though, there are pretty interesting classes on assembly which are pre-reqs for classes on optimizing/debugging. Also it never hurts to learn more. But this definitely isn't something I'd be too worried about coming in.
After K.N. King's book, we don't really cover many more C books. But Kernighan and Ritchie's C Programming Language is a good thing to read.
In terms of C++ books we cover, it's a little weird. For one class, we needed C++ Primer and another we needed C++ Primer Plus. We've also needed Algorithms in C++ by Robert Sedgewick and a couple others. However, most of our classes don't have "required" textbooks, just recommended ones. If you send me a message I can compile a list of the recommended ones from my courses this far.
Personally, I'd highly recommend all of Scott Meyers' books, such as Effective C++, More Effective C++, and Effective STL.
This kind of stuff is available in painful detail in Josuttis' book, but there is a fair bit of "other stuff" in there.
That said, better than the fish book for someone who wants just the good stuff would be Effective STL and/or Standard C++ IOStreams & Locales.
Not a tutorial but a book. It's a bit dated now as it was released far before C++11, but still a good reference.
http://www.amazon.com/Effective-STL-Specific-Standard-Template/dp/0201749629
> STL != standard library
Oh come on. You know as well as I that STL isn’t even a term in the standard and that, although they are historically different, they are often used interchangeably even by C++ gurus (such as /u/stl and Scott Meyers). And that was clearly not the point of /u/ErstwhileRockstar (nor, I suspect, of /u/mitsuhiko).
> even some "old but gold" ones are fine
The Scott Meyers book you mentioned, Effective C++, is just that: old but gold.
I'd also suggest you read his other books, Effective STL and More Effective C++.
These 3 books stand out amongst many for me, for their accessibility and effectiveness. It is worthwhile reading them now and getting a solid understanding on pre C++11 design principles etc.
Once his Effective C++11 book comes out, read that too!
Following these, but now moving from intermediate to expert level, the single biggest influence on how I designed and wrote C++ was Modern C++ Design by Andrei Alexandrescu.
It's pre C++11, but the insights into generic algorithm design using templates are just incredible.
Excerpt from the description on Amazon:
> Alexandrescu offers a cutting-edge approach to software design that unites design patterns, generic programming, and C++, enabling programmers to achieve expressive, flexible, and highly reusable code.
If there is ever one book I recommend people to read, it's this one.