B.1 — Introduction to C++11

What is C++11?

On August 12, 2011, the ISO (International Organization for Standardization) approved a new version of C++, called C++11. C++11 adds a whole new set of features to the C++ language! Use of these new features is entirely optional -- but you will undoubtedly find some of them helpful. The prior tutorials have all been updated to be C++11 compliant.

The goals and designs of C++11

Bjarne Stroustrup characterized the goals of C++11 as such:

  • Build on C++’s strengths -- rather than trying to extend C++ to new areas where it may be weaker (eg. Windows applications with heavy GUI), focus on making it do what it does well even better.
  • Make C++ easier to learn, use, and teach -- provide functionality that makes the language more consistent and easier to use.

To that end, the committee that put the language together tried to obey the following general principles:

  • Maintain stability and compatibility with older versions of C++ and C wherever possible. Programs that worked under C++03 should generally still work under C++11.
  • Keep the number of core language extensions to a minimum, and put the bulk of the changes in the standard library (an objective that wasn’t met very well with this release)
  • Focus on improving abstraction mechanisms (classes, templates) rather than adding mechanisms to handle specific, narrow situations.
  • Add new functionality for both novices and experts. A little of something for everybody!
  • Increase type safety, to prevent inadvertent bugs.
  • Improve performance and allow C++ to work directly with hardware.
  • Consider usability and ecosystem issues. C++ needs to work well with other tools, be easy to use and teach, etc…

C++11 isn’t a large departure from C++03 thematically, but it did add a huge amount of new functionality.

Major new features in C++11

For your interest, here’s a list of the major features that C++11 adds. Note that this list is not comprehensive, but rather intended to highlight some of the key features of interest.

There are also many new classes in the C++ standard library available for use.

B.2 -- Introduction to C++14
A.3 -- Using libraries with Code::Blocks

37 comments to B.1 — Introduction to C++11

  • Rafal

    Hi Alex!

    I am wondering if there is a chance to introduce the multithreading module in your tutorial in this year?


  • Pooja


    Your all concepts are well explained in deeper and detailed. Each time i read, I get more knowledge. So thank you for that.

    I would like you to make a tutorial on multithreading. With all the example of new functions supported.

  • LinguaC

    Hi Alex,
    Thank you so much for the entire website, it is an ideal reference for beginners, and I benefited a lot from learning. Would you please make a tutorial sooner for lambdas?

  • Just_A_Random_Person

    You wrote "char16_t and char_32t and new literals to support them (no tutorial yet)". I do believe that you meant not "char_32t" but "char32_t".

  • DecSco

    Variatic templates -> Variadic templates

  • Hey Alex,

    Kudos for maintaining this website for so long! I refreshed my C++ knowledge by reading your material and love how crisp and concise the content is. I see that you have a couple of items above marked as 'no tutorial yet'. Is there a contribution mechanism in place to help you create some of the tutorials? Maybe setup a github repo so we can open PR's for certain pending topics?

    • Alex

      There's no external contribution mechanism in place currently. I've dabbled with that in the past but it's never worked out well. Primarily, I don't have a good way to reward those who contribute, so there's no incentive (other than returning the good will) for people to spend the time. It would be unfair for me to monetize other people's content and not give them a cut, but I don't have an infrastructure in place for that.

  • Mates

    Hello Alex, thanks for all the amazing tutorials here. I don't know the site for too long, so if I can ask, how long does it take you to make a new tutorial? Can we expect any tutorials soon? Are all topics pre-C++11 covered already? And would it be possible to rewrite all of standard library by myself?
    Best regards, Mates

    • Alex

      New tutorials take a fair amount of time to write (generally 3 to 5 solid working sessions). Writing the core material tends to take 1 to 2 sessions, then another 1 to 2 sessions to think up, implement, and test examples that demonstrate the material, and then another day for review, polish, and edits. Creating quiz questions takes even longer.

      Also answering random questions takes a lot of time that would otherwise go into writing new material. I wouldn't expect too many new tutorials -- I'm slammed at work and home right now. Most of the pre-C++11 functionality has been covered at this point, minus the standard library which is huge.

      Not sure what you mean by "rewrite all of the standard library by myself" -- you mean write your own classes that do the same thing? You could, but I wouldn't advise it. Why reinvent the wheel?

      • Mates

        Thanks for your answer! Regarding the standard library, I meant more like whether it is pure-C++, as I don't understand how some classes are implemented, for example std::initializer_list. Also, how long is 'solid working session'?

        • Alex

          The details about how the standard library is implemented (e.g. which algorithms they use) is compiler-specific. However, the interface that you use is consistent, so what you really need to understand is how to use the classes properly, not how they're implemented.

          A working session for me is a good uninterrupted 3-4 hours. Now that I have 2 young children, finding uninterrupted blocks that long doesn't happen very often. :(

  • Hardik

    Alex? Which is the best WEBSITE or BOOK to learn graphic desigining in C++ (basic to advanced) ?
    Thanks in Advance :)
    Waiting for your Reply.....

  • silasqwerty1

    Have you considered making a similar page for C++14? I know it wasn't really a big release (at least in comparison), but I think it would be useful for reference if nothing else.

  • ali

    hi alex,
    we are looking forward (a long time) topics that are not tutorial yet. please don't forget us :) especially threads and lambda.

  • Mirza Safaraz

    hi Alex, after reading all of this material, what should I do then to master cpp, any recomendation ?
    Thanks before, this tutorial make a lot of sense

    • Alex

      Put your knowledge into practice. Write lots of programs. Learn something new (e.g. graphical applications in C++).

      • Mirza Safaraz

        okay I'll do it, thanks for this great tutorial !!!

      • Paolo Lampitella

        You should really consider writing yourself some tutorial on graphical applications. While each major package out there already has extensive tutorials, let me say that I find your approach quite unique and very valuable, as it is both complete and meaningful in the path it follows trough the different topics. When following your tutorial, I had to go back only once, for an example using a const pointer to a c-style string (which I simply forgot it has static attribute and doesn't go out of scope, but that was eventually explained in a comment This is something that everybody would be pleased to see applied to any possible programming scenario. I recognize the caducity of any information related to some library with respect to a programming language (still, C++ is not exactly steady with respect to, say, Fortran), but if you mix that with design patterns (as per other requests), that's something that is going to have absolute value. Just look at how bad are all the books on Qt, for example.

        • Alex

          I've definitely thought about it. But there's still so much from fundamental C++ (and especially the standard library) that warrants exploration and has broader application... so I probably won't get to this anytime soon. :(

  • Ariela

    Looking forward to a possible tutorial on lambdas, because I can't for the life of me wrap my head around them.

  • Mehul

    Hi Alex,

    Can you also please create the tutorial for design patterns ..

    As i love your tutorials as it gives me in depth information of topics


  • Le Thu Ha

    I dont see smart pointer here. It is quite a topic in c++11.

  • savino

    where can we start to learn android programing or smart phone programng? what do you recommend to learn? windows 7,8, android, ois,?? whats next? thanks

  • 1pavan23

    Good work by this site.
    Please provide information in Design patterns like
    (Singleton, Abstract Factory, Builder, Factory methods, Template Method, Observer, Adapter, Facade) with good examples

    I am waiting for above information.

  • fsxfreak1

    Awesome, was waiting for this!

Leave a Comment

Put all code inside code tags: [code]your code here[/code]