Monday, November 10, 2014

EMC++ Exits Publishing Purgatory!

I just received the following from O'Reilly:

Congratulations! Your book went to print on Friday, and we've now completed production. The Retail Availability Date for ebooks on and Amazon is tomorrow, 11/11. For print books, it's estimated at 12/2. 



Kirilodius said...

Great! Will it be available on safari books?

Scott Meyers said...

@Kirilodius: My understanding is that it will be. When it will show up on Safari, I don't know. If you don't see it there in, say, a week, let me know, and I'll see if I can find out what the problem is.

mmocny said...

Congratulations Scott. Looking forward to my print copy arriving just in time for xmas holidays.

Dhruva Krishnamurthy said...

Looking forward to getting a printed copy of the book (though I have a Safari account). However, I wish the title was different and not appear like endorsing EMC^2 (

abigagli said...

Great job and congratulations. That's for sure one of the very few books which waiting for is always worth doing.
P.S. I've just realized that N4164 seems not to adopt your "universal references" terminology in favor of "forwarding references" which I like a lot less. I haven't yet downloaded the final EMC++ (I'm still on the pre-release), but I imagine you wouldn't try to change anything about that in the book, right?
And more generally, if I may ask, what's your opinion on 4164?

Scott Meyers said...

@abigagli: I was in the loop on N4164. At CppCon (immediately after the "final" version of EMC++ had been sent to O'Reilly), I was told that some members of the standardization committee were very uncomfortable with the term "universal reference" and wanted something different. Herb and I talked about it, and we ultimately agreed on "forwarding reference," where "agreed" means that I have no objection to using that term instead of universal reference.

The book itself sticks with "universal reference," but I added the following footnote:

Item 25 explains that universal references should almost always have std::forward applied to them, and as this book goes to press, some members of the C++ community have started referring to universal references as forwarding references.

I also added an index entry for "forwarding reference," so readers should be able to use either term without confusion.

Anonymous said...

Yours was the first c++ book I read. It got me hooked, and reading c++98 books became something of an obsession. Then c++ land was cured with seven years of book drought. Where did all those authors go, I wondered. I'll pick this one up though. Hopefully there will be a new wave of modern c++ books coming out. There should be plenty to write about with the new language an all.

Anonymous said...

hello .congratulation. i living i Iran. i and many others Iranian love buying and reading high quality books on programming. many universities in Iran select C++ for programming courses. but we do not allowed to have cards like master because of international sanctions against Iran. so we Iranian with 80 millions population can't directly buy books from sites like amazon. some websites in Iran exist that can buy books form sites like amazon (they have a person in U.S) and this web site sells books to us with about twice price.
actually books with original price already are so expensive for us ( because prices are in dollar and our currency (rial) is so weak) and when this price makes twice, having such kind of books for us more like a dream.
so with this situation never one (or if i want to be fair maybe less than 10 person in Iran for a high quality book) buy such books.
so actually we live in the hell

Kirilodius said...

I`m happy to inform you that Effective Modern C++ is available in Safari Books Online web site. Still I'm recommending to everyone to have own printed copy of this perfect book. Thanks you Scott you are the best!

mikeb said...

Congratulations! Great book.

derpyloves said...

Grats on teh new book Dr. Meyers. I own all your other ones in "big block of atoms" form--a format I abandoned a while back. Glad to see you paid such meticulous attention to high quality ebook publishing, and I hope it pays off for you very well!

I look forward to digging into your latest work.

Scott Meyers said...

@derploves (and everybody else who buys the ebooks): Please let me know how well the ebook formats work. I'm still a dead-trees guy myself, so while I do my best to ensure ebook quality, I don't have any in-the-trenches experience with the book in those formats. If you find problems or have suggestions for improvement, please let me know! (Posting here is fine, as is email:

Jon Kalb said...

Congratulations, Scott. Eagerly awaited doesn't begin to describe.

Anonymous said...

You can download the book for free here:

Scott Meyers said...

@Anonymous: Thanks for letting me know about illegal copies. I've forwarded the link to O'Reilly. They have a team that deals with this kind of stuff as a matter of course.

Vladimir said...

Hello, Scott!

In Chapter 5 you say
class Widget {
Widget(Widget&& rhs); // rhs is an lvalue, though it has
… // an rvalue reference type

However, Bjarne says that "an rvalue can be bound to an rvalue
reference (but not to an lvalue reference) and an lvalue can be bound to an lvalue reference (but not to an rvalue reference)".

So how come rhs is an lvalue? The following won't even work:
void g()
Widget w1;
Widget w2 {w1};
For it to work, one could do the following
void g()
Widget w1;
Widget w2 {std::move(w1)};
But now we use an rvalue std::move(w1).

Further, in Item 24 you say
auto&& var2 = var1; // not rvalue reference

However, N4164 says "a parameter of type C&& is always an rvalue reference — except when C is a template parameter type or auto, in which case it behaves very differently even though language-technically it is ___still an rvalue reference____."

So it turns out that var2 is an rvalue reference, although a special-case one.

Please comment on this.

Best regards,

Scott Meyers said...

@Vladimir: From the book's Introduction:

A useful heuristic to determine whether an expression is an lvalue is to ask if you can take its address. If you can, it typically is. If you can’t, it’s usually an rvalue. A nice feature of this heuristic is that it helps you remember that the type of an expression is independent of whether the expression is an lvalue or an rvalue. That is, given a type T, you can have lvalues of type T as well as rvalues of type T. It’s especially important to remember this when dealing with a parameter of rvalue reference type, because the
parameter itself is an lvalue

That explains why rhs is an lvalue: you can take its address. It also explains why you can't bind an lvalue to it: because its type is an rvalue reference. The fact that parameters of rvalue reference type are themselves lvalues is one of the more confusing things in C++11, and that's why I address it right at the beginning of the book.

As for var2, it's an lvalue reference, though it's syntactically declared to be an rvalue reference. That's because what looks to be an rvalue reference becomes, after reference collapsing, an lvalue reference. So even though it looks like it's an rvalue reference, it's really an lvalue reference. This is confusing, and that's why I introduce the term "universal reference" to refer to references such as var2 that look syntactically like rvalue references but that are actually lvalue references. I also point out that the notion of a "universal reference" is a "lie," and I explain that I cover all the details and the full truth (special type deduction followed by reference collapsing) in Item 28.

N4164 concedes that there needs to be an official term for what I call universal references, but it prefers to use "forwarding reference" instead of "universal reference." As I noted in an earlier comment on this blog post, I have a footnote at the beginning of Item 24 explaining that universal references and forwarding references are the same thing.

Unknown said...

I finally bougth at oreally because amazon dont have it for now, only a prereserve

I had look a quick eye on it and i like the way it looks, the pdf is well formed and i liked the structure, i think i will enjoy it, thnaks for doing it

Scott Meyers said...

@Juan AG: The print book is available only for pre-order at both Amazon and O'Reilly, because the books are currently in the process of being printed (i.e., they don't yet exist.) Digital versions of the book are available for immediate download at both sites.

I'm glad your initial impression of the PDF is positive, and I hope that continues to be the case as you look more closely at the book.

Anonymous said...

Hi Scott.

Your book can be illegally downloaded using search engine.

For example this page is generated using search

Anyway, congratulation of your book. I've already bought it form O'Reilly (electronic form).

Scott Meyers said...

@Anonymous: As before, I've forwarded the information on illegal links to O'Reilly. Thanks for the tip.

Jon said...

@Scott, has there been any conclusion to the debate over passing move-only types by value?

Scott Meyers said...

@Jon: The most recent discussion between Herb and me was at C++ and Beyond in September. Herb still advocates pass by value for such types. I'm increasingly opposed (and was never in favor). At C&B, Andrei weighed in on Herb's side, but in talking with him later, my impression was that he failed to distinguish between prvalues and xvalues, assuming that all rvalues are prvalues.

So I guess the conclusion is that I continue to view the practice as a bad habit, and Herb and others disagree. My sense is that among those people who stand up on stages and try to persuade you to do things their way, I'm in the minority camp, but I hope to sway a few people to my point of view next month, because this is one of the topics I'll be addressing in my keynote at Meeting C++ in Berlin.

Unknown said...

Hi Scott,

First of all, congratulations with the digital and paper release of your book! It must feel like a big relief, I guess.

I just bought and downloaded the PDF version from O'Reilly and are reading it on my Samsung tab S 10 inch tablet. It renders perfectly. I am really looking forward reading it!

Greetings from the Netherlands,