/* */ /* */

Tuesday, November 1, 2011

C++11 Training Materials Updated

Now that C++0x has become C++11, I updated the name of my training materials and released the latest revision to past buyers. This marks the third updated release of these materials since their original publication in April 2010.

Updating notes for a multiple-day training course (such as my three-day C++11 seminar) has an interesting constraint:  unless the changes involve adding or removing full days worth of material, the length of the course can't be changed.  For a topic like C++11, where I'm learning more all the time, this means that I sometimes want to add information without changing the length of the class.  One way I do that is by adding comments below the PowerPoint slides.  The comments don't get shown in class, but they elaborate on material in the slides.

For the most recent materials update, one of the ways I took advantage of this was by taking the following bullet point from a list of "Other Features" in C++11 (that the course doesn't really cover, typically because the features are less important or because there's currently little or no compiler support for them):
  • Contextual keywords for alignment control, preventing derivation, and constraining virtual function overrides.
I added the following elaboration in the comments:
The identifiers override and final are contextual keywords. Both classes and virtual functions may be declared final. final classes may not be used as bases (per 9/3), and final virtual functions may not be overridden in derived classes.  A virtual function declared override must override a function in a base class. The following is an amalgam of examples from 10.3/4-5:
struct B {
    virtual void f() const final;
    virtual void f(int);
};
struct D : B {
    void f() const;                      // error: D::f attempts to override final B::f
    void f(long) override;             // error: wrong signature overriding B::f
    void f(int) override;               // OK
};
Because elaborations like this generally don't get presented in class, this means that the information in the training materials is in some ways more comprehensive than the information I deliver during a presentation. On the other hand, during a live presentation, people can ask about whatever they want, so I typically address a variety of topics that aren't in the training materials at all.

To the best of my knowledge, my training materials are currently the best source of accessible information about C++11. The Internet is filled with pages about C++11, but many of them were written at a time when draft C++0x was still in a state of flux, and unless you already know the details of the final version of C++11, it's hard to judge whether what you read on a given page is up to date.  The final C++11 standard is definitive, of course, but it's currently expensive (about US$400 at the ISO store), and I don't think anybody will tell you it's easy to read or understand.  There is, as far as I know, only one book out that covers C++11, and although I have not read it, given its recent publication date, I'd be surprised if it takes into account the very latest changes that took place during standardization. (I'd hoped to link to this book, which I know about only from a press release, but now I can't find it. If you know which book it is -- or of other books currently available that cover C++11 -- please let me know.)

To be frank, my training materials aren't perfectly up to date, either.  I had hoped that they were, but it's a big standard (1353 pages), and just yesterday I received a set of bug reports from a member of the standardization committee pointing out places where my notes' treatment of some parts of C++11 are out of sync with the final standard.  I'll fix those problems in the next release of the training materials, a release that, like all releases, will be automatically pushed out to anybody who has purchased the materials.

If you're interested in a book-like publication covering the most important parts of C++11 (both language and library), I encourage you to consider purchasing my training materials.  If you like my other publications, I think you'll like these, too.  To see exactly what you'll be getting, check out the free sample.

Because this publication is in an unconventional format (annotated training materials), is available from a lesser-known publisher (Artima), and is electronic-only (DRM-free PDF), getting the word out about it has been challenging.  I'd appreciate it if you'd let people know about it, whether through blogs, tweets, social networks (the politically correct term for Facebook), email, or that most retro of communications mechanisms, face-to-face conversation.

Thanks,

Scott

8 comments:

Anonymous said...

Was that C++11 book, "The C++ Standard Library Extensions: A Tutorial and
Reference" maybe?

Anonymous said...

Professional C++ mentions they drill down into C++11 changes.

http://www.amazon.com/Professional-C-Wrox-Guides/dp/0470932449/ref=sr_1_1?ie=UTF8&qid=1320174617&sr=8-1

Scott Meyers said...

Pete Becker's book, "The C++ Standard Library Extensions," is about TR1 (from 2005), not C++11. The book "Professional C++" (whose URL at Amazon was posted) is, I believe, the book I was thinking of when I wrote my post. Again, I have not read it, but using Amazon's "Search Inside This Book" capability, I got zero hits for "rvalue references", "move semantics", and "perfect forwarding". I don't know if this reflects the content of the book, the limitations of Amazon's search capability, or whether I just did something wrong, but if you're looking for C++11 information, these are certainly terms I'd check for before making a purchase.

Scott

Robert Zeh said...

After going through the example, and looking at the word counting example, I was wondering why it didn't use the range based for in some of the for loops?

Scott Meyers said...

Can you give an example of where you think a range-based for should have been used? There are a couple of places on page 14 where I could have used one, but the for loops there work with two iterators rather than with a container, so I'd have to invoke std::make_pair on the iterators in order to turn them into a range, and I frankly think that's more work than what I've got. But perhaps I've overlooked something.

Scott

Robert Zeh said...

Page 14 was what I was thinking about, but I didn't read it closely enough to realize that it was using two iterators instead of a container.

Mr. Xyz said...

Hi Scott,

Few months ago I bought a copy of intro to C++0x material from Artima, and vaguely remember that updates would be provided. However I am not able to get your latest C++11 notes.

Can you please let me know how do I get the latest ones?

Thanks,
Sarang

Scott Meyers said...

@Mr. Xyz: Assuming you registered with Artima when you purchased the notes, you should have been automatically notified of any updates that were subsequently released. If you have not received such notifications, send me email (smeyers@aristeia.com), and I'll forward your message to Artima, who will then contact you.

Thanks,

Scott