I will start studying C++11 in a month and was wondering, what benefits does C++11 provide when compared to C++03?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If I had to nail it down to two things, I’d say that “rvalue references and variadic templates” are the most profound improvement of C++11 over C++03. Both allow you to do things that really should have been possible all along, and add enormous expressive power to the language. Finally you can have a proper
unique_ptrand containers with move semantics thanks to rvalue references, and direct construction rather than copy construction thanks to both constructions playing in harmony:Another huge improvement is the incorporation of a memory model into the language that allows for a standardized description of concurrent execution (multi-threading).
There are tons of smaller additions that make the language more expressive, though, and allow you to do things you simply couldn’t do previously:
brace-initialization allows you to initialize class member arrays and value-construct automatic objects.
initializer lists allow you to initialize containers.
a better concept of constant expressions.
a better-specified memory layout for classes and unions, as well as fine-grained notions of “triviality” to allow optimizations as much as possible.
lambda expressions and closures make algorithmic and functorial programming much easier and more viable.