C++ Standards

The Latest C++ Standard

C++23 is the most recent C++ standard at the time of writing, with C++26 next. Here is what changed, how versions are named, and how to compile for each.

On this page
  1. The Short Answer
  2. How C++ Standards Are Named
  3. What C++23 Added
  4. What C++26 Is Expected to Bring
  5. Which Standard Should You Learn?
  6. Setting and Checking the Standard
  7. If You Meant the C Language
  8. Where to Read the Official Text

The Short Answer

At the time of writing, the newest published C++ standard is C++23, formally ISO/IEC 14882:2024. The next revision, C++26, was still in progress, so check the status on isocpp.org before you rely on any feature that appears only in a draft.

If you are learning C++, you do not need the newest version to start. Most tutorials, books and existing codebases are written for C++11 through C++20, and the core ideas carry over to every version.

How C++ Standards Are Named

The International Organization for Standardization (ISO) publishes C++ standards. The work is done by a working group called WG21. The main releases are:

  • C++98, the first ISO standard.
  • C++03, a small revision of C++98.
  • C++11, a large update that changed how modern C++ code is written.
  • C++14, a smaller update to C++11.
  • C++17, C++20, C++23 and C++26.

Since C++11, a new revision has come out about every three years. The number in the name is the year the revision was targeted for, and the published document can appear a little later. C++23, for example, was published as ISO/IEC 14882:2024.

What C++23 Added

C++23 added a set of library types and a few language changes. These are the ones beginners are most likely to meet:

  • std::expected holds either a result or an error. It gives you a way to report failure without throwing an exception.
  • std::print and std::println, in the <print> header, write formatted output using the same format strings as std::format.
  • Deducing this lets a member function take its object as an explicit parameter. It can replace some pairs of const and non-const overloads.
  • std::flat_map and std::flat_set are sorted containers that keep their data in contiguous memory by default.
  • if consteval checks whether code is running at compile time or at run time.

Here is a short program that uses std::println:

#include <print>

int main() {
    std::println("Hello from C++{}!", 23);
}

Support depends on your compiler, its standard library and its version. Check a compiler support table before you rely on a particular C++23 feature.

What C++26 Is Expected to Bring

C++26 is the revision after C++23. Among the larger features discussed for it are static reflection, which lets code inspect types and their members at compile time, and contracts, which let code state preconditions and postconditions for a function. Whether each feature makes it into the final text is something to verify, because the committee changes the draft as it works.

Which Standard Should You Learn?

For most beginners, C++17 or C++20 is a sensible target. Both cover the everyday tools you will see in real code, such as smart pointers, lambdas and range-based for loops, and current compilers support both well. Once the basics feel comfortable, try a few C++23 features to see what has changed.

Setting and Checking the Standard

Compilers pick a default standard, and that default changes between versions. Set the standard yourself with a flag so your builds are predictable:

g++ -std=c++20 -Wall -Wextra main.cpp -o main
clang++ -std=c++23 -Wall -Wextra main.cpp -o main

Recent GCC and Clang versions accept -std=c++23, while older versions may need -std=c++2b. On Windows, MSVC uses /std:c++20 or /std:c++latest instead, as in cl /std:c++20 /EHsc main.cpp.

To confirm which standard a build is using, print the __cplusplus macro. Each standard has its own value:

Standard __cplusplus value
C++11 201103L
C++14 201402L
C++17 201703L
C++20 202002L
C++23 202302L
#include <iostream>

int main() {
    std::cout << __cplusplus << '\n';
}

MSVC keeps reporting an old value unless you add the /Zc:__cplusplus option.

If You Meant the C Language

If your search for “latest c standard” was about C, the answer is different. The C language has its own standards, separate from C++, and the newest one is C23, published in 2024. The history of those versions is covered in our article on what are C standards.

Where to Read the Official Text

ISO sells the published standards, so many people read free sources instead. The committee posts working drafts of the next revision on its public document site, open-std.org, and cppreference.com documents which features arrived in which standard. Drafts are close to the final text but not identical, so cite the published standard for anything formal.

Keep exploring

Guides from other topics

All topics →

std::function in C++

std::function is a C++ wrapper that holds any callable with a matching signature, such as a function, lambda or functor, and calls it the same way.

std::function 5 min read

Inheritance in C++

A practical guide to inheritance in C++: the syntax, access specifiers, constructor order, virtual functions and common mistakes, with short code examples.

Inheritance 7 min read