このページはC++23に採用された言語機能の変更を解説しています。
のちのC++規格でさらに変更される場合があるため関連項目を参照してください。
概要
言語機能
| マクロ名 | 値 | 機能 |
|---|---|---|
__cpp_auto_cast |
202110L |
auto(x)およびauto{x}によるキャスト |
__cpp_constexpr |
202211L |
constexpr関数内でのstatic constexpr変数を許可 |
__cpp_explicit_this_parameter |
202110L |
自身のオブジェクトを明示的にパラメータとして指定する |
__cpp_if_consteval |
202106L |
if consteval |
__cpp_implicit_move |
202207L |
暗黙的なムーブを簡略化 |
__cpp_multidimensional_subscript |
202211L |
添字演算子の多次元サポート |
__cpp_named_character_escapes |
202207L |
名前付きユニバーサルキャラクタ名 |
__cpp_range_based_for |
202211L |
範囲for文が範囲初期化子内で生じた一時オブジェクトを延命することを規定 |
__cpp_size_t_suffix |
202011L |
(符号付き)size_tリテラルのためのサフィックス |
__cpp_static_call_operator |
202207L |
thisポインタをもつ必要のない演算子をstaticとして宣言できるようにする |
ライブラリ
ライブラリの機能テストマクロは全て<version>でも提供される。
| マクロ名 | 値 | 機能 | ヘッダ |
|---|---|---|---|
__cpp_lib_adaptor_iterator_pair_constructor |
202106L |
std::queueとstd::stackにイテレータ2つのコンストラクタを追加 |
<queue><stack> |
__cpp_lib_algorithm_iterator_requirements |
202207L |
<algorithm>のRangeイテレータ対応 |
<algorithm><memory><numeric> |
__cpp_lib_allocate_at_least |
202302L |
std::allocator::allocate_at_least()の追加 |
<memory> |
__cpp_lib_associative_heterogeneous_erasure |
202110L |
テンプレート型を受けるerase()の追加 |
<map><set><unordered_map><unordered_set> |
__cpp_lib_barrier |
202302L |
バリアフェーズの完了ステップの仕様変更 | <barrier> |
__cpp_lib_bind_back |
202202L |
std::bind_back()の追加 |
<functional> |
__cpp_lib_byteswap |
202110L |
std::byteswap()の追加 |
<bit> |
__cpp_lib_common_reference |
202302L |
T&とreference_wrapper<T>のcommon_referenceをT&に変換 |
<type_traits> |
__cpp_lib_common_reference_wrapper |
202302L |
T&とreference_wrapper<T>のcommon_referenceをT&に変換 |
<functional> |
__cpp_lib_concepts |
202207L |
std::equality_comparable_withなどをムーブのみ可能な型に対応 |
<compare><concepts> |
__cpp_lib_constexpr_bitset |
202207L |
std::bitsetのconstexpr対応 |
<bitset> |
__cpp_lib_constexpr_charconv |
202207L |
std::to_chars()とstd::from_chars()のconstexpr対応 |
<charconv> |
__cpp_lib_constexpr_cmath |
202202L |
いくつかの関数をconstexpr対応 |
<cmath><cstdlib> |
__cpp_lib_constexpr_memory |
202202L |
std::unique_ptrのconstexpr対応 |
<memory> |
__cpp_lib_constexpr_typeinfo |
202106L |
std::type_info::operator==()のconstexpr対応 |
<typeinfo> |
__cpp_lib_containers_ranges |
202202L |
コンテナのコンストラクタのRange対応 | <vector><list><forward_list><map><set><unordered_map><unordered_set><deque><queue><stack><string> |
__cpp_lib_expected |
202211L |
<expected>の追加 |
<expected> |
__cpp_lib_flat_map |
202207L |
std::flat_mapとstd::flat_multimapの追加 |
<flat_map> |
__cpp_lib_flat_set |
202207L |
std::flat_setとstd::flat_multisetの追加 |
<flat_set> |
__cpp_lib_format |
202207L |
std::formatの時刻型のローカライズ対応 |
<format> |
__cpp_lib_format_ranges |
202207L |
std::formatterのRange対応 |
<format> |
__cpp_lib_formatters |
202302L |
std::formatterのstd::stacktrace対応とstd::thread::id対応 |
<stacktrace><thread> |
__cpp_lib_forward_like |
202207L |
std::forward_like()の追加 |
<utility> |
__cpp_lib_generator |
202207L |
std::generatorの追加 |
<generator> |
__cpp_lib_invoke_r |
202106L |
std::invoke_r()の追加 |
<functional> |
__cpp_lib_ios_noreplace |
202207L |
std::ios::noreplaceの追加 |
<ios> |
__cpp_lib_is_implicit_lifetime |
202302L |
std::is_implicit_lifetimeの追加 |
<type_traits> |
__cpp_lib_is_scoped_enum |
202011L |
std::is_scoped_enumの追加 |
<type_traits> |
__cpp_lib_mdspan |
202207L |
<mdspan>の追加 |
<mdspan> |
__cpp_lib_modules |
202207L |
モジュール<std>と<std.compat>の追加 |
|
__cpp_lib_move_iterator_concept |
202207L |
std::move_iterator<T*>をランダムアクセスイテレータにする |
<iterator> |
__cpp_lib_move_only_function |
202110L |
std::move_only_functionの追加 |
<functional> |
__cpp_lib_optional |
202110L |
std::optionalにモナド操作を追加 |
<optional> |
__cpp_lib_out_ptr |
202106L |
std::out_ptrとstd::inout_ptrの追加 |
<memory> |
__cpp_lib_ranges |
202302L |
std::ranges::range_adaptor_closureの追加<ranges>の様々な機能追加 |
<algorithm><functional><iterator><memory><ranges> |
__cpp_lib_ranges_as_const |
202207L |
std::ranges::cbeginが常に定数イテレータを返すようにする。std::ranges::as_const_viewの追加 |
<ranges> |
__cpp_lib_ranges_as_rvalue |
202207L |
std::ranges::as_rvalue_viewの追加 |
<ranges> |
__cpp_lib_ranges_cartesian_product |
202207L |
std::ranges::cartesian_product_viewの追加 |
<ranges> |
__cpp_lib_ranges_chunk |
202202L |
std::ranges::chunk_viewの追加 |
<ranges> |
__cpp_lib_ranges_chunk_by |
202202L |
std::ranges::chunk_by_viewの追加 |
<ranges> |
__cpp_lib_ranges_contains |
202207L |
std::ranges::contains()の追加 |
<algorithm> |
__cpp_lib_ranges_enumerate |
202302L |
std::ranges::enumerate_viewの追加 |
<ranges> |
__cpp_lib_ranges_find_last |
202207L |
std::ranges::find_last()とstd::ranges::find_last_if()とstd::ranges::find_last_if_not()の追加 |
<algorithm> |
__cpp_lib_ranges_fold |
202207L |
std::ranges::にfoldアルゴリズムの追加 |
<algorithm> |
__cpp_lib_ranges_iota |
202202L |
std::ranges::iota()の追加 |
<numeric> |
__cpp_lib_ranges_join_with |
202202L |
std::ranges::join_with_viewの追加 |
<ranges> |
__cpp_lib_ranges_repeat |
202207L |
std::ranges::repeat_viewの追加 |
<ranges> |
__cpp_lib_ranges_slide |
202202L |
std::ranges::slide_viewの追加 |
<ranges> |
__cpp_lib_ranges_starts_ends_with |
202106L |
std::ranges::starts_with()とstd::ranges::ends_with()の追加 |
<algorithm> |
__cpp_lib_ranges_stride |
202207L |
std::ranges::stride_viewの追加 |
<ranges> |
__cpp_lib_ranges_to_container |
202202L |
std::ranges::toの追加 |
<ranges> |
__cpp_lib_ranges_zip |
202110L |
std::ranges::zip_viewとstd::ranges::zip_transform_viewとstd::ranges::adjacent_viewとstd::ranges::adjacent_transform_viewの追加 |
<ranges><tuple><utility> |
__cpp_lib_reference_from_temporary |
202202L |
std::reference_constructs_from_temporaryとstd::reference_converts_from_temporaryの追加 |
<type_traits> |
__cpp_lib_shift |
202202L |
std::ranges::shift_left()とstd::ranges::shift_right()の追加 |
<algorithm> |
__cpp_lib_spanstream |
202106L |
<spanstream>の追加 |
<spanstream> |
__cpp_lib_stacktrace |
202011L |
<stacktrace>の追加 |
<stacktrace> |
__cpp_lib_start_lifetime_as |
202207L |
std::start_lifetime_as()の追加 |
<memory> |
__cpp_lib_stdatomic_h |
202011L |
<stdatomic.h>の追加 |
<stdatomic.h> |
__cpp_lib_string_contains |
202011L |
std::basic_string::contains()とstd::basic_string_view::contains()の追加 |
<string><string_view> |
__cpp_lib_string_resize_and_overwrite |
202110L |
std::basic_string::resize_and_overwrite()の追加 |
<string> |
__cpp_lib_to_underlying |
202102L |
std::to_underlying()の追加 |
<utility> |
__cpp_lib_tuple_like |
202207L |
tuple-likeコンセプトの追加 |
<map><tuple><unordered_map><utility> |
__cpp_lib_unreachable |
202202L |
std::unreachable()の追加 |
<utility> |
__cpp_lib_print |
202403L |
<print>の追加 |
<ostream><print> |