C++ 規格比較表 — C++98 から C++23 まで
C++ は 3 年おきに改訂され、機能が大きく増えています。「この機能はどの規格から?」「このプロジェクトが C++11 固定だけど使える?」を即座に判断できるよう、主要機能を並べました。
C++981998
初期 C++ — クラス・テンプレート・STL の原型
- class/inheritance/virtual
- テンプレート(関数/クラス)
- STL: vector, list, map, string, iostream, algorithm
- 例外, RTTI(typeid, dynamic_cast)
- 名前空間, new/delete
C++032003
マイナー修正版
- 値初期化のルール明確化など。文法的には C++98 とほぼ同じ。
C++112011 — モダン元年
「モダン C++」の始まり。ここで大革命
- auto / decltype — 型推論
- ラムダ式
[](int x){ return x*2; }
- Range-for
for (auto& x : v)
- nullptr(NULL を置換)
- move semantics / rvalue reference
T&&
- unique_ptr / shared_ptr
- std::thread / mutex / atomic
- enum class
- constexpr(制限付き)
- Uniform initialization
T x{1,2,3}
- override / final / delete / default
- static_assert, noexcept, alignas
- Variadic templates
class... Args
C++142014
C++11 の仕上げ
- Generic lambda
[](auto x){...}
- Return-type deduction
auto f() { return 1; }
- Variable template
template<class T> T pi = 3.14;
- make_unique(C++11 には無かった)
- constexpr 制約緩和(ループ可能に)
C++172017 — 実用版
現在の実務標準。このサイトのベースライン
- structured binding
auto [a,b] = p;
- if-init
if (auto it = m.find(k); ...)
- std::optional / std::variant / std::any
- std::filesystem
- std::string_view
- fold expression
(args + ...)
- CTAD:
std::vector v{1,2,3} で vector<int>
- guaranteed copy elision(RVO の義務化)
- nested namespace
namespace a::b {}
- inline variable
- constexpr if
C++202020 — 第2の革命
大きな追加が多数
- Concepts
template<std::integral T>
- Ranges:
v | std::views::filter(...) | std::views::transform(...)
- Coroutines:
co_await / co_yield / co_return
- Modules:
import std; など(実装はまだ発展途上)
- std::span(配列ビュー)
- std::format(printf 風型安全)
- std::jthread(RAII スレッド)
- consteval / constinit
- operator<=>(3 方向比較、spaceship)
- Designated initializer
{.x=1, .y=2}
C++232023
C++20 機能の整備 + 新規追加
- std::expected — エラーハンドリング(Rust の Result に相当)
- std::print / println — format の出力版
- std::mdspan — 多次元 span
- ranges 拡充(
zip, chunk, slide 等)
- if consteval、static operator()
- deducing this: メンバ関数の this を明示的に
- スタックトレース
std::stacktrace
代表機能の対応表
| 機能 | 98 | 11 | 14 | 17 | 20 | 23 |
| auto 型推論 | — | ● | ● | ● | ● | ● |
| ラムダ式 | — | ● | ● | ● | ● | ● |
| make_unique | — | — | ● | ● | ● | ● |
| structured binding | — | — | — | ● | ● | ● |
| std::optional | — | — | — | ● | ● | ● |
| std::filesystem | — | — | — | ● | ● | ● |
| concepts | — | — | — | — | ● | ● |
| ranges | — | — | — | — | ● | ● |
| modules | — | — | — | — | ● | ● |
| std::format | — | — | — | — | ● | ● |
| std::expected | — | — | — | — | — | ● |
どのバージョンから始めるべきか? 2026 年時点で実務のベースラインは C++17。C++20 は Clang/GCC 最新では動くが MSVC がやや遅れ。新規プロジェクトは C++20 を見据えつつ、C++17 で安定運用がバランスよい。