Comparison of Features Across C++ Versions from C++98 to C++23

Comparison of Features Across C++ Versions from C++98 to C++23

Core Feature List of Major C++ Versions (Only the most critical changes in the standard are listed for quick reference):

C++98 / C++03

(C++98 is the first ISO standard, C++03 is a technical revision, essentially the same)

  • • Standard Template Library (STL): vector, list, map, algorithm, etc.
  • • Exception handling <span>try / catch</span>
  • • Namespaces <span>namespace</span>
  • • RTTI (Run-Time Type Identification): <span>dynamic_cast</span> / <span>typeid</span>
  • • Templates
  • • Introduction of <span>bool</span> type

C++11 (The “Big Leap” version of C++)

  • • Type deduction with <span>auto</span>
  • • Type retrieval with <span>decltype</span>
  • • Replacement of <span>NULL</span> with <span>nullptr</span>
  • • Anonymous functions: Lambda expressions
  • • Range-based for loops: <span>range-based for</span>
  • • Compile-time assertions: <span>static_assert</span>
  • • Smart pointers: <span>std::unique_ptr</span>, <span>std::shared_ptr</span>
  • • Rvalue references <span>&&</span> and move semantics
  • • Variadic templates
  • • Initialization lists: <span>int arr[]{1,2,3};</span>
  • • Constant expressions: <span>constexpr</span>

C++14 (Minor enhancements)

  • • Generic Lambdas (parameters can use <span>auto</span>)
  • • Return type deduction (function <span>auto f(){ return 1; }</span>)
  • • Binary literals: <span>0b1010</span>
  • • Digit separators: <span>1'000'000</span>
  • <span>std::make_unique</span>
  • • Relaxed <span>constexpr</span> (constexpr functions can have branches and loops)

C++17

  • • Compile-time conditions with <span>if constexpr</span>
  • • Structured bindings: <span>auto [a,b] = pair;</span>
  • • Inline variables: <span>inline constexpr int x = 5;</span>
  • <span>std::optional</span> / <span>std::variant</span> / <span>std::any</span>
  • <span>std::string_view</span>
  • • Fold expressions
  • • Standard library for <span>filesystem</span>
  • • New attributes: <span>[[nodiscard]]</span>
  • • Stronger template deduction rules

C++20

  • Concepts (Stronger template constraints)
  • • Ranges library (<span>std::ranges</span>)
  • • Modules
  • • Coroutines (<span>co_await</span>, <span>co_yield</span>, <span>co_return</span>)
  • • Three-way comparison: <span><=></span> (Spaceship operator)
  • • More powerful <span>constexpr</span> (almost all logic can be executed at compile time)
  • • Calendar and timezone library extension: <span><chrono></span>
  • <span>std::span</span> (Lightweight view)
  • • New attributes: <span>[[likely]]</span> / <span>[[unlikely]]</span>

C++23 (Latest release)

  • <span>if consteval</span> (Detects if executed in a constant context)
  • • Extended <span>constexpr</span> (supports more STL algorithms)
  • <span>std::expected</span> (New type for error handling replacing exceptions)
  • • Ranges extension (<span>views::join_with</span>, etc.)
  • <span>std::print</span> / <span>std::println</span>
  • • Multidimensional subscript operator: <span>obj[i,j]</span>
  • • Extended Lambdas: deducing this type, capturing parameter packs, etc.
  • <span>std::mdspan</span> (Multidimensional array view)

👉 This shows that C++11 was a major leap, with subsequent versions iterating on its foundation.

👌 Understood, you are right, the table above does look a bit “crowded” and lacks clarity, as if paragraphs were crammed into table cells. I will help you reformat it into a truly clear comparison table — each standard will only include key features, with a concise structure.

✅ Comparison Table of Major C++ Standard Features (Concise and Clear Version)

Standard Version Key Language Features Standard Library Features
C++98 / 03 – Namespaces <span>namespace</span> – Exception handling <span>try/catch</span> – RTTI <span>dynamic_cast</span>, <span>typeid</span> – Templates <span>bool</span> type – STL (containers, algorithms, iterators)
C++11 <span>auto</span>, <span>decltype</span> – Lambda expressions <span>nullptr</span> – Rvalue references & move semantics – Variadic templates <span>constexpr</span> – Range-based for <span>static_assert</span> – Smart pointers: <span>unique_ptr</span>, <span>shared_ptr</span> – Initialization lists <span>{}</span>
C++14 – Generic Lambdas (<span>auto</span> parameters) – Return type deduction <span>auto f(){}</span> – Relaxed <span>constexpr</span> (loops and branches allowed) <span>std::make_unique</span> – Binary literals <span>0b1010</span> – Digit separators <span>1'000'000</span>
C++17 <span>if constexpr</span> – Structured bindings <span>auto [a,b]</span> – Fold expressions <span>std::optional</span>, <span>std::variant</span>, <span>std::any</span><span>std::string_view</span><span>std::filesystem</span> – Inline variables <span>inline</span><span>[[nodiscard]]</span> attribute
C++20 – Concepts (template constraints) – Modules – Coroutines – Three-way comparison <span><=></span> – Ranges library <span>std::ranges</span> – More powerful <span>constexpr</span><span>std::span</span> – Calendar/timezone extensions <span><chrono></span><span>[[likely]]</span>, <span>[[unlikely]]</span> attributes
C++23 <span>if consteval</span> – Lambda extensions (capturing parameter packs, deducing this type) – Multidimensional subscript <span>obj[i,j]</span> <span>std::expected</span> – Ranges extensions (<span>join_with</span>, etc.) <span>std::print</span> / <span>std::println</span><span>std::mdspan</span> – More STL algorithm support for <span>constexpr</span>

Leave a Comment