ISO C++11 Published
iso.org
iso.org
for example, it would probably avoid introducing pointers until very late, using standard containers for data structures, etc.
the approach would be more "here is a modern language using the right subset of c++" rather than "you can make clunky old c++ work by following these arcane rules to avoid weird exceptions" (ie it shows a complete, modern language, not a collection of work-arounds). and preferably it should be aimed at an experienced programmer, so it should be compact and not try teach me "how to program" in general.
Needless to say, C++ is very complex and so the book doesn't cover a good part of it. But I think it is a fairly good start and is not too long either.
Introduce shared_ptr<> early, explain how actual pointers should pretty much only be used for compatibility with old-style libraries or if you're the one writing the standard library.
So, please, don't push shared_ptr as a magic one-size-fits all solution, especially to newbies. There's a reason why reference counting is not used everywhere.
With C++ you must remember that it's using pass-by-value semantics by default, which is very different from pass-by-reference semantics of other (syntactically similar) languages (like Java). Using shared_ptr's will not get rid of this fact and makes things even more complicated.
In fact, I have a very hard time to find _any_ use for shared_ptr's in my C++ projects. scoped_ptr's and ptr_containers have proven to be more useful.
That said, shared_ptr isn't a solution to everything. Sometimes scoped_ptr (called unique_ptr in tr1) or intrusive_ptr is a better tool. Often if you don't want to share or transfer ownership, passing around a raw ptr or reference is even better and the only option if you want to work with embedded structs (but the newed memory should still be owned by some RAII smart pointer even if it gets passed around as a bare pointer)
One of the things I like about C++ is that it gives me choices and I still use raw pointers sometimes but shared_ptr removes a lot of manual memory management noise and makes it much easier to write robust, correct, exception-safe code.
[1] http://www.amazon.com/Effective-Specific-Improve-Programs-De... (Make sure you get the latest edition, a lot has changed for the better)
That is, of course, only until a new edition of Meyers' book comes out.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n324...
How much support is there for C++11 in compilers today?
Unfortunately a lot of companies don't use today's compilers, but use many-year old versions. For example, Apple still ships gcc 4.2 which is over 4 years old now and supports none of these features.
For the same reason they are switching to LLVM. So if Clang supports C++11 well enough, Apple switches to that, and others who wont use newer GCC versions do the same, many companies may be back on track regarding compiler compatibility.