C++ STL containers, 'under the bonnet'? - c++

what would be the best way to learn what actually happens with the STL containers? I presume just programming wouldnt be enough. Are there any books specifically aimed at this?

This book is quite good, even if maybe it does not go deep enough in the details as you would like: The C++ Standard Library: A Tutorial and Reference

Generic Programming and the STL: Using and Extending the C++ Standard Template Library

The best way to figure out what's happening 'under the bonnet' is to actually look under the hood and find the source code :)
Otherwise just read the documentation. I recommend this site, or this book.

Stephan T. Lavavej is currently doing video lectures about the STL.

There are books dedicated for C++ STL. You could try one of those.

Found the below resources quite useful:
May not be up-to-date but SGI Stl Programmer's Guide. It has a good conceptual overview of the STL library.
Source code navigation:
I've used the Free Evaluation Source Insight Code Browser which allows to jump all around the source code from sgi's stl code.
Alternatively you can try out LXR, doxygen, Ctags.
Videos:
STL Tutorial by Stephen Lavavej
Going Deep into STL with Stephen Lavavej
Inside STL with Stepan Lavavej
C++0x Features in VC10
See Also:
C++ Templates - The Complete Guide by Nicolai Josuttis
C++ Template Meta-Programming - Concepts, Tools and Techniques
Inside the C++ Object Model by Stanley Lippman

Related

Is there any C++ coding standard like PSR-1/2

I was searching for C++ coding standard.
I found lots of standards:
Google C++ Style Guide
High Integrity C++ Coding Standard Version 4.0
...
Is there any C++ coding standard like PSR-1/21 that every C++ developer follows?
1) PHP Standard Recommendation. PSR-1: Basic Coding Standard. PSR-2: Coding Style Guide.
Is there any C++ coding standard like PSR-1/2 that every C++ developer follows?
The C++ language standard is made official by the ISO C++ Committee.
The standard comes with iterations and versionings (like c++-11, c++-14, c++-17) that are (mostly) backwards compatible.
That's actually what every C++ developer needs to follow.
If you're actually asking about coding style guides, that's a different thing, and no there aren't any common standards, beyond what's forbidden/discouraged from the c++ standard language.
Well, rethinking the standard style guide wording, there actually are established coding style standards like e.g. Misra C++.
You'll need to consider fulfilling these to get into certain business domains. You may think these are silly, and too restrictive, but still the customer wants you to fulfill these style guides.
It's your choice, and you'll need to estimate your extra efforts and costs (for e.g. investing in a static analysis tool that confirms standard compliance), and put that on the customers bill.
Even though I think the given answers are already good i would like to add the following comment:
There is a rather new project C++ Core Guidelines which tries to do what you are looking for (at least I think so). It is still in an ongoing process but IMHO it is already worth to take a look. There are also some nice talks about these guidelines
CppCon 2015: Bjarne Stroustrup “Writing Good C++14”
and
CppCon 2015: Herb Sutter "Writing Good C++14... By Default"
which explains its main purpose quite nicely. They emphasize static code analysis alot and in my opinion they try to push it alot with these guidelines.
But an important information is
FAQ.6: Have these guidelines been approved by the ISO C++ standards
committee? Do they represent the consensus of the committee?
No. These guidelines are outside the standard. They are intended to
serve the standard, and be maintained as current guidelines about how
to use the current Standard C++ effectively. We aim to keep them in
sync with the standard as that is evolved by the committee.
In the end it means, it is just another set of rules in the sense of the other answers.
No.
If there were a single style guide that everybody followed, why would there be multiple style guides?
For what it's worth, I don't follow anyone else's style guide, and in my opinion neither should you.
Your job may require you to follow a certain guide, but then you wouldn't be asking us which to use.
Notice that I refuse to call these style guides "standards".

What's the easiest way to use stack, queue and linked list in C++ in Xcode on the Mac?

My professor told me about STL (he doesn't use a Mac currently). With some googling, I found that STL has been deprecated for years. What's the current way to do this most easily?
The STL is the precursor to certain parts of the standard library (STD). Sometimes the term is used to refer to those parts.
To use stack, #include <stack>. There's also <list> and <queue>, and many others.
Here is a good reference site: http://en.cppreference.com/w/
And as always, a good book: The Definitive C++ Book Guide and List
You are just reading this wikipedia article, which states that #include <*.h> (old C libraries) have been deprecated.

How to take advantage of the standard library

I've been coding with c++ for over 2 years already, started by independently learning it with online guides/books. Now, after 2 years, I think I master the language pretty well. One thing though I haven't paid attention to:
It's about the standard c++ library. Recently I had to deal with abstract io streams and buffers, and I realized that I don't know anything about powerful use of them. I only know the basic containers and io operations.
So is there any good sites/books where I can learn how to take great advantage of the streams/library in general, and learn the architecture of the library? Links to sites would be appreciated :)
I think these books are a good source:
The C++ Standard Library: A Tutorial and Reference,
Nicolai M. Josuttis,
ISBN 0201379260
Effective STL: 50 Specific Ways to Improve the Use of the Standard Template Library,
Scott Meyers,
ISBN 0201749629

What do I need to know about C++0x? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Where can I learn more about C++0x?
I am fairly familiar with C++03 but I still need to come to terms with C++0x so I would like to read some fairly digestible information on C++0x.
I have looked at the Wikipedia but I am on the look out for something that is more readable. So is there a book or series of blog entries that provide a nice introduction to the matarial?
There is a ton of stuff on this very site - some of the posts include very informative discussion. I would point you to Google but it's going to be more efficient to search in C++0x tagged posts here imo.
Here's a good one to start with, which includes indirection to Stroustrup's own summary. Scott Meyers has presentation materials on the topic here.
Check up on your favourite compiler's support for the new version. Microsoft VC10 support is summarized here. GCC info can be found here.
Official state of the standard for the language is available here. Evolution of the language is in many places tied to ongoing work in Boost. See here for some info on that.
Honestly my preference these days is to look here for 99% of needed info rather than resort to a book.
It's too early for a book. The standard isn't fixed yet.
Now, if you think wikipedia is hard to read, you might try Stroustrup's page about it. However it might seem harder to read to some.
There's a good tutorial on codeproject here for VC++. Even if you aren't using Visual Studio though it's still useful.
Learn whatever feature you would have loved having in C++98 in the first place. For me, it was variadic templates, lambda functions, decltype and other cool stuff.
If you still don't know what to learn first, maybe you should try to understand what issues from the C++98 are adressed. I say this because all the xvalue, move semantics and al stuff is quite heavy to grasp if you don't know what the problems were (and still are btw). This may imply learning some more C++98 first.
Then, you can always browse the Wikipedia article and look at whatever you find cool. Implementors don't provide all the features yet, so you'll look like a 5 year old staring at the front window of a toy store. This is a good reason to behave like one.
I really liked this series of blog posts by the Visual C++ Team Blog:
The Future of the C++ Language
Lambdas, auto, and static_assert: C++0x Features in VC10, Part 1
Rvalue References: C++0x Features in VC10, Part 2
decltype: C++0x Features in VC10, Part 3
I found the Overview of the New C++ (C++0x) book by Scott Meyers to be a good, detailed summary of the main features. It's more of a presentation with very detailed footnotes that an actual book, but it's still an excellent, short read.
I suggest you using the book functionality of Wikipedia to make it more readable/printable. I did the same for the C++0x page.

C++0X Standard in support of Multi-threaded Programs

C++ Standards committe is to publish the new standards for the language we all love so much in 2010 and the biggest support that is being provided, is for multi-threaded applications.... this sounds exciting .... any more inputs on this????
If you don't have a specific question regarding the new standards, I recommend doing some Wikipedia/Google reading. Also, check out these c++0x StackOverflow questions.
For C++0x threads, check out http://www.stdthread.co.uk/. It's a complete implementation of the C++0x threading libraries, written by the guy who wrote a lot of the proposals that made it into the standard.
Prasoon already linked to my article on Devx.com, and Terry linked to my implementation of the C++0x thread library.
You might also be interested in the series of posts on my blog about multithreading in C++0x, or in my book C++ Concurrency in Action where I go into greater detail about the details of multithreading with C++0x.