Skip to content

C++11

C++11 (ISO/IEC 14882:2011) is the most milestone version in C++ history, known as the starting point of "modern C++." It brought fundamental changes at both the language and standard library levels.

Core Changes

Language Level

FeatureSignificance
auto type deductionReduces redundant type declarations
Rvalue references and move semanticsEliminates unnecessary deep copies, greatly improving performance
Lambda expressionsFirst-class closures, simplifying STL algorithm usage
Variadic templatesType-safe variadic functions, metaprogramming building blocks like enable_if
constexprStarting point for compile-time computation
nullptrType-safe null pointer constant
enum classScoped enumerations, eliminating implicit conversions
static_assertCompile-time assertions
Delegating constructorsConstructor reuse
User-defined literalsCustom operator"" syntax sugar
Range-based forConcise container iteration syntax

Standard Library Level

ComponentSignificance
unique_ptr / shared_ptr / weak_ptrReplaces auto_ptr, correct resource ownership semantics
std::thread / std::mutex / std::atomicFirst standardized multithreading support
std::arrayFixed-size array, replacing C-style arrays
std::tupleHeterogeneous container
<chrono>Type-safe time library
<regex>Regular expressions
<random>High-quality random numbers
std::functionType-erased universal callable wrapper
std::reference_wrapperCopyable reference wrapper
std::initializer_listList initialization support
std::begin / std::endUniform iteration interface for arrays and containers
std::ratioCompile-time rational arithmetic
Unordered containersunordered_map, unordered_set

Why It Was a Watershed Moment

C++ before C++11 (C++98/03) and C++ after C++11 differ fundamentally in coding style:

  • Move semantics changed the economics of pass-by-value — returning by value is no longer expensive
  • Lambdas made algorithm-first coding possible over hand-written loops
  • auto made iterators and template return values no longer a nightmare
  • Concurrency went from "platform-dependent" to "language-guaranteed"

Compiler Support

CompilerFull Support Version
GCC4.8.1+
Clang3.3+
MSVCVS 2015 (19.0)+

Further Reading

Select a specific feature from the sidebar to begin reading, or start directly with auto type deduction.

Released under the MIT License