Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C++

Các phiên bản C++ (C++ Versions)

Có nhiều phiên bản ngôn ngữ C++, mỗi phiên bản là implementation của compiler dựa trên spec của ISO C++ committee. Các phiên bản chính:

Phiên bản Chuẩn ISO Tên thường gọi Điểm nhấn
1 ISO/IEC 14882:1998 C++98 Chuẩn đầu tiên, có STL
2 ISO/IEC 14882:2003 C++03 Sửa lỗi C++98 (bug fix)
3 ISO/IEC 14882:2011 C++11 Đột phá lớn: auto, lambda, move, smart ptr, thread, regex, range-for, nullptr, variadic template...
4 ISO/IEC 14882:2014 C++14 Cải tiến C++11: generic lambda, auto return, variable template, binary literal...
5 ISO/IEC 14882:2017 C++17 Structured binding, if constexpr, optional/variant/string_view/filesystem, parallel algo...
6 ISO/IEC 14882:2020 C++20 Concepts, modules, coroutines, ranges, <=>, format, span, constexpr mở rộng...
7 ISO/IEC 14882:2023 C++23 expected, mdspan, print/println, #embed, deducing this, multidimensional subscript...
8 ISO/IEC 14882:2026 (dự kiến) C++26 Reflection, contracts, pattern matching, linear algebra, text processing... (đang phát triển)

Mỗi phiên bản chủ yếu thêm thư viện chuẩn, mở rộng API, deprecate API cũ. Spec draft miễn phí tại: isocpp.org | GitHub: cplusplus/draft.

Hỗ trợ compiler hiện tại (2024)

Compiler C++20 C++23
GCC 13+ Hoàn toàn Phần lớn
Clang 16+ Hoàn toàn Phần lớn
MSVC 19.3+ (VS 2022 17.3+) Hoàn toàn Phần lớn

Flag biên dịch: -std=c++20 (GCC/Clang), /std:c++20 (MSVC).