C++ is standardised by ISO/IEC JTC1/SC22/WG21. A source file carries no version mark, so the
version is chosen by a compiler option, and code can test it with
__cplusplus. These pages
describe C++23. C++26 is the next revision and is not covered here.
Summary
| Name | Standard | __cplusplus | GCC and Clang | MSVC |
|---|---|---|---|---|
| C++98 | ISO/IEC 14882:1998 | 199711L | -std=c++98 | None |
| C++03 | ISO/IEC 14882:2003 | 199711L | -std=c++03 | None |
| C++11 | ISO/IEC 14882:2011 | 201103L | -std=c++11 | None |
| C++14 | ISO/IEC 14882:2014 | 201402L | -std=c++14 | /std:c++14 |
| C++17 | ISO/IEC 14882:2017 | 201703L | -std=c++17 | /std:c++17 |
| C++20 | ISO/IEC 14882:2020 | 202002L | -std=c++20 | /std:c++20 |
| C++23 | ISO/IEC 14882:2024 | 202302L | -std=c++23 | /std:c++latest |
C++ began as “C with Classes”, created by Bjarne Stroustrup at Bell Labs. The first standard followed in 1998.
C++98
The first ISO standard defined the core of the language and the library.
- Classes, inheritance, virtual functions, multiple inheritance and operator overloading.
- Templates, including specialisation and member templates.
- Exceptions, namespaces, and run-time type information through
dynamic_castandtypeid. - The cast keywords,
bool,explicit,mutable,typenameandwchar_t. - The standard library: containers, iterators, algorithms, strings, streams and locales.
exportfor separately compiled templates, which almost no compiler implemented.
C++03
C++03 was a corrected edition of C++98. It fixed defects and did not add major features. The main language change was value initialisation. In 2007 Technical Report 1 (TR1) proposed library additions, most of which became part of C++11.
C++11
The largest revision since C++98, and the first to add a defined multi-threaded memory model.
| Area | Additions |
|---|---|
| Types and deduction | auto, decltype, nullptr, long long, char16_t, char32_t, scoped enumerations, forward enumeration declarations, trailing return types, type aliases |
| Move semantics | Rvalue references, move constructors and assignment, ref-qualifiers |
| Initialisation | List initialisation, std::initializer_list, default member initialisers, delegating and inheriting constructors |
| Functions and classes | Lambda expressions, = default, = delete, override, final, noexcept, constexpr, generalised unions and PODs |
| Templates | Variadic templates, alias templates, extern template, expression SFINAE, right angle brackets |
| Literals and text | Raw strings, user-defined literals, Unicode string literals |
| Statements | Range-based for, static_assert |
| Concurrency | The memory model, thread_local, thread-safe local statics |
| Other language | Attributes, alignof, alignas, inline namespaces, the C99 preprocessor additions |
| New headers | <array> <atomic> <cfenv> <chrono> <cinttypes> <condition_variable> <cstdint> <cuchar> <forward_list> <future> <initializer_list> <mutex> <random> <ratio> <regex> <scoped_allocator> <system_error> <thread> <tuple> <typeindex> <type_traits> <unordered_map> <unordered_set> |
| Library | std::unique_ptr, std::shared_ptr, std::function, std::move_iterator, emplace, new algorithms |
Removed export templates. Deprecated dynamic exception specifications and std::auto_ptr.
C++14
A smaller release that completed C++11.
| Area | Additions |
|---|---|
| Language | Variable templates, generic lambdas, lambda init-capture, relaxed constexpr, binary literals, digit separators, function return type deduction, aggregates with default member initialisers, [[deprecated]], omission of allocation calls |
| New header | <shared_mutex> |
| Library | std::make_unique, std::shared_timed_mutex, std::shared_lock, std::integer_sequence, std::exchange, std::quoted, type alias forms of type traits, literal suffixes for strings, durations and complex numbers |
C++17
| Area | Additions |
|---|---|
| Declarations | Structured bindings, inline variables, nested namespace definitions, using with several names |
| Control | if constexpr, initialisers for if and switch |
| Templates | Fold expressions, class template argument deduction, auto non-type template parameters |
| Expressions | Evaluation order rules, guaranteed copy elision, constexpr lambdas, *this capture, u8 character literals, hexadecimal floats |
| Other language | noexcept as part of the type system, __has_include, [[fallthrough]], [[maybe_unused]], [[nodiscard]], over-aligned allocation |
| New headers | <any> <charconv> <execution> <filesystem> <memory_resource> <optional> <string_view> <variant> |
| Library | std::byte, parallel algorithms, std::clamp, std::launder, std::scoped_lock, mathematical special functions, try_emplace, extract and merge |
Removed trigraphs, register as a storage class, ++ on bool,
dynamic exception specifications other than throw(), std::auto_ptr,
std::random_shuffle, the old binders and adaptors. Deprecated std::iterator,
std::result_of and <codecvt>, among others.
C++20
| Area | Additions |
|---|---|
| The large features | Concepts, coroutines, modules and the three-way comparison operator |
| Declarations | char8_t, consteval, constinit, designated initialisers, parenthesised aggregate initialisation, abbreviated function templates, using enum |
Control and constexpr | Initialisers in range-based for, further relaxed constexpr |
| Lambdas | Template lambdas, pack expansions in init-captures |
| Integers | Two’s complement signed integers, unified shift behaviour |
| Other language | [[likely]], [[unlikely]], [[no_unique_address]], feature-test macros, __VA_OPT__, optional typename in many contexts |
| New headers | <barrier> <bit> <compare> <concepts> <coroutine> <format> <latch> <numbers> <ranges> <semaphore> <source_location> <span> <stop_token> <syncstream> <version> |
| Library | Ranges, std::format, calendars and time zones in <chrono>, std::jthread, std::span, std::bit_cast, std::make_shared for arrays, std::erase and std::erase_if |
Removed throw(). Deprecated the implicit capture of this by [=],
some uses of volatile, and the comma operator in subscripts.
C++23
| Area | Additions |
|---|---|
| Classes and calls | Explicit object parameters, multidimensional subscript operator, static operator() and static operator[] |
| Expressions | auto(x) and auto{x}, the z integer suffix, simpler implicit move |
| Control | if consteval, labels at the end of a block, alias declarations in init-statements, lifetime extension in range-based for |
constexpr | Non-literal variables, labels and goto in constexpr functions, static variables in constexpr functions |
| Text | \N{} and delimited escapes, UTF-8 required as an input encoding, white space before line splicing |
| Other language | Extended floating-point types, #elifdef, #elifndef, #warning, [[assume]], attributes on lambdas, declaration-order layout, class template argument deduction from inherited constructors |
| New headers | <expected> <flat_map> <flat_set> <generator> <mdspan> <print> <spanstream> <stacktrace> <stdfloat> <stdatomic.h> |
| Library | The std and std.compat modules, std::expected, std::print, std::mdspan, std::generator, std::move_only_function, std::unreachable, std::start_lifetime_as, ranges::to, new range adaptors and range folds |
Removed garbage collection support, mixed wide string literal concatenation and non-encodable wide
character literals. Deprecated std::aligned_storage, std::aligned_union and
std::numeric_limits::has_denorm.