Thread: C++11 books

  1. #1
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413

    C++11 books

    I think I've asked this before, but quite a bit of time has passed and I'm looking for something more specific now, so I'll ask again.

    As the title says, I'm looking for C++11 books. I am fairly new to C++, like, novice level, and maybe a little better than that in terms of object-oriented programming. So, I'm looking for a book that perhaps focuses a great deal on the object-oriented aspects of C++ and the new features that come with C++11. Better yet, a book for someone who knows how to program in other languages but wants to learn the ins and out of C++. In any case, the C++11 part is a must. If I'm going to learn, I want to learn the most up-to-date standard and nothing else. TIA.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    In any case, the C++11 part is a must. If I'm going to learn, I want to learn the most up-to-date standard and nothing else.
    O_o

    You have asked this before, and my opinion hasn't changed. You do not need a book covering C++11 specifically because the vast majority of features extend rather than replace C++98 features. You can learn all the C++11 you want, but if you only learn what C++11 added/changed, you'll be severely undereducated.

    So, I'm looking for a book that perhaps focuses a great deal on the object-oriented aspects of C++ and the new features that come with C++11.
    Focusing on the "OOP" aspects of C++ is also a mistake. C++ is a huge and diverse language allowing you to use virtually any paradigm or technique you'd ever desire; focusing on "OOP" will leave you unprepared for generics. You may not care for generics, but the power of the standard library comes form generics so you'll want to venture into that as well.

    I am NOT suggesting you dive into writing generics; I'm only suggesting you learn to use them, as in the standard library, as you learn C++.

    Soma

    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  3. #3
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    I wanted to focus on OOP because I've learned some about the other areas and feel that OOP, like real-world class and member function design, is my weakness.

    Might not be the best choice, but for now I'm going to go with The C++ Standard Library: A Tutorial and Reference (2nd Edition): Nicolai M. Josuttis: 9780321623218: Amazon.com: Books because of its examples of C++11 standard library usage.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Stroustrup's "The C++ Programming Language" has been released in its C++11 version.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Might not be the best choice, but [...] examples of C++11 standard library usage.
    O_o

    I wouldn't recommend any book because of C++11, but I have recommend that book, earlier editions, for years.

    That said, it is not a beginner book; I think you'd be a lot happier with "Accelerated C++".

    If you can afford it, at least try and get both.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  6. #6
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    528
    Quote Originally Posted by CornedBee View Post
    Stroustrup's "The C++ Programming Language" has been released in its C++11 version.
    I have been waiting way too long for that .
    Last edited by Aslaville; 07-03-2013 at 12:38 PM.

  7. #7
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by CornedBee View Post
    Stroustrup's "The C++ Programming Language" has been released in its C++11 version.
    I think that's the book I'm going to get next, it's supposed to be available to order later this month from Amazon. Probably would've bought it instead if it wasn't still in the pre-order stage on Amazon.

  8. #8
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by phantomotap View Post
    O_o

    I wouldn't recommend any book because of C++11, but I have recommend that book, earlier editions, for years.

    That said, it is not a beginner book; I think you'd be a lot happier with "Accelerated C++".

    If you can afford it, at least try and get both.

    Soma
    I might. I'm kind of looking for something away from beginner. I do have a Deitel C/C++/Java book and went through all the C++ chapters, so I'll take a chance at jumping in.

  9. #9
    Registered User
    Join Date
    Mar 2013
    Posts
    63
    Quote Originally Posted by Epy View Post
    I think that's the book I'm going to get next, it's supposed to be available to order later this month from Amazon. Probably would've bought it instead if it wasn't still in the pre-order stage on Amazon.
    I got my copy last month from Amazon (US)

    James

  10. #10
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I'm kind of looking for something away from beginner. I do have a Deitel C/C++/Java book and went through all the C++ chapters, so I'll take a chance at jumping in.
    O_o

    Well, I despise the Deitel books. (Well, the Deitel I know. I'm sure there is more than one Deitel in the world.)

    I did misunderstand your level of skill/knowledge with C++. If you already have a foundation, "The C++ Standard Library" is great material, and you should be very happy with your purchase.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

  11. #11
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    Well, I despise the Deitel books.
    Could you give a brief explanation as to why you dislike the book, and also what revision you're talking about. I used book many years ago and found it quite useful. However the version I used did pre-date the C++ standard (1994). I will say that I never cared for the newer editions.

    Well, the Deitel I know. I'm sure there is more than one Deitel in the world
    Well there are/were at least two H.M. and P.J. Deitel.

    Jim

    I totally agree about the Josuttis book, looks like it may be time to look into upgrading.

    Jim

  12. #12
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    I didn't find the Deitel book helpful for C or C++, it's way too introductory, like the kind of crap you would find in a QBASIC book from the 1980s. I had to use a book called "C for Scientists and Engineers" in college which was also introductory, but much better.

  13. #13
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Could you give a brief explanation as to why you dislike the book, and also what revision you're talking about.
    O_o

    I'd say the Deitel, as if literature, were poorly paced with gaping "plot holes" and entirely too much "overshadowing".

    I'd have to dig around to find revisions, but as for why: the Deitel books I've read are only a few dozen steps away from what is expected of Herbert Schildt.

    So, yeah, infinitely better than Herbert Schildt books, but still, the Deitel books, while mostly correct with descriptions actually honoring code examples, get a lot of stuff, notably exceptions and canonical forms of common idioms, wrong. The Deitel books do decent coverage--more than can be said for Herbert Schildt books--of "RAII" and the "copy/swap idiom" for example, but the coverage is opposed to canonical normal forms, and such problems as I have mostly come from poorly ordered, structure, material with breaking references to other material. (You'll repeatedly see early examples with much too much complexity referencing material which will not be explained until chapters later which depends on material from earlier chapters. You'll repeatedly see later examples without enough complexity where the material is simply repeating how two pieces fit together because the earlier examples already have shown how the same two pieces fit together with a reference to coming material.)

    That sort of thing may not sound like a great sin, but canonical expectations are actually codified for a reason in C++.

    Code:
    class SExample
    {
        // ...
        SExample & operator =
        (
            const SExample & fRHS
        )
        {
            return(SExample(fRHS).replace(*this));
        }
        // ...
        SExample & replace
        (
            SExample & fRHS
        )
        {
            int mTemp(mData);
            mData = fRHS.mData;
            fRHS.mData = mTemp;
            return(*this);
        }
        // ...
        int mData;
    };
    I guess there is nothing really wrong with introducing the "copy/swap idiom" with different names and slightly different external functionality. (You can even easily add a non-member, non-friend `swap' using `replace' to do the job.) However, if we wait until we have covered more of the foundation--thus waiting on introducing the "copy/swap idiom" until a perfect place to introduce the canonical form of the concept is available--we may offer an explanation of the rationale and one of many reasons behind the use of "using declarations" at reduced scope in a more complex but infinitely more illustrative example.

    Code:
    class SExample
    {
        // ...
        SExample
        (
            const SExample & fOther
        ):
            mData(0)
          , mSize(0)
        {
            if(fOther.mData && fOther.mSize)
            {
                // We allow the exception to propagate
                // preventing us from using a bad pointer.
                mData = new int[mSize];
                // (Omitted) We use `std::copy' to copy the array of integer values.
            }
        }
        // ...
        SExample & operator =
        (
            SExample fRHS // We require a copy for destructive use as a temporary.
        )
        {
            fRHS.swap(*this); // We can simply move the values of members between
            return(*this); // instances because we have a temporary available.
            // The temporary will be destroyed which will cleanup
            // the resource we had owned.
        }
        // ...
        void swap
        (
            SExample & fOther
        )
        {
            // Ask the compiler to use "Argument-dependent Name Lookup" to resolve
            // which implementation of `swap' to use for each member.
            using std::swap;
            swap(mData, fOther.mData); // These data members are trivial types so swapping
            swap(mSize, fOther.mSize); // is an operation which does not raise exceptions.
        }
        // ...
        int * mData;
        int mSize;
    };
    // ...
    // By using the same feature from `SExample::swap', "Argument-dependent Name Lookup",
    // we may now provide a swapping operation available to client code for our
    // `SExample' class which does not raise exceptions. 
    void swap
    (
        SExample & fLHS
      , SExample & fRHS
    )
    {
        fLHS.swap(fRHS);
    }
    Instead of introducing a trivial example early only to show the "copy/swap idiom" at home, we have introduced an example strictly building on material learned from previous examples which shows why the "copy/swap idiom" exists, the normal interface, and the canonical implementation.

    Semantically, the example I've offered does a lot more with only a little more code.

    Soma
    “Salem Was Wrong!” -- Pedant Necromancer
    “Four isn't random!” -- Gibbering Mouther

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Books (not specifically programming books)
    By DavidP in forum General Discussions
    Replies: 6
    Last Post: 11-05-2009, 07:33 PM
  2. Books?
    By arnis in forum C++ Programming
    Replies: 9
    Last Post: 03-12-2003, 07:01 PM
  3. Books on C++
    By tnngo in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 03-08-2003, 04:14 PM
  4. Books and such!!!
    By Aesir16 in forum Game Programming
    Replies: 3
    Last Post: 11-24-2002, 10:13 PM