Overview of C++11 language and library features
C++11 was a major overhaul of the language, introducing modern C++ paradigms.
Core Language Features:
- Automatic Type Deduction:
autoanddecltypeto avoid redundant type names. - Move Semantics: Rvalue references, move constructors, and move assignment operators to minimize data copying.
- Smart Pointers:
std::unique_ptrandstd::shared_ptrfor RAII-based resource management. - Lambdas: Unnamed function objects for inline logic.
- Variadic Templates: Templates that handle an arbitrary number of arguments.
- Uniform Initialization: Use of brace initialization
{}for all types. - Concurrency: A formal memory model,
std::thread,std::mutex,std::atomic, andstd::future. - Other essentials:
nullptr,long long, scoped enums (enum class),constexpr,static_assert, andnoexcept.
Standard Library Additions:
- Containers:
std::unordered_map(hash tables),std::forward_list(singly-linked list), andstd::array(fixed-size array). - Utilities:
std::tuple, type traits for metaprogramming, and regular expressions.