最終更新日時(UTC):
が更新

履歴 編集

機能テストマクロ(C++20)

概要

言語機能

マクロ名 機能
__cpp_aggregate_paren_init 201902L 丸カッコの値リストからの集成体初期化を許可
__cpp_char8_t 201811L UTF-8エンコーディングされた文字の型としてchar8_tを追加
__cpp_concepts 201907L コンセプト
__cpp_conditional_explicit 201806L 関数を条件付きでexplicitにする構文を追加
__cpp_constexpr 201907L
202002L
定数式からの仮想関数の呼び出しを許可
定数式でのdynamic_cast、多態的なtypeidを許可
constexpr関数内でのtry-catchブロックを許可
定数式内での共用体のアクティブメンバの変更を許可
constexpr関数内でのトリビアルなデフォルト初期化を許可
constexpr関数内で未評価のインラインアセンブリを許可することによる組み込み関数のconstexpr有効化
__cpp_constexpr_dynamic_alloc 201907L 可変サイズをもつコンテナのconstexpr
__cpp_constexpr_in_decltype 201711L 評価されない文脈での定数式評価によって特殊メンバ関数がインスタンス化されることを規定
__cpp_consteval 201811L 即時関数
__cpp_constinit 201907L コンパイル時初期化を強制するconstinitキーワードを追加
__cpp_deduction_guides 201907L 集成体クラステンプレートのテンプレート引数推論
エイリアステンプレート経由でのクラステンプレートのテンプレート引数推論
__cpp_designated_initializers 201707L 指示付き初期化
__cpp_generic_lambdas 201707L ジェネリックラムダのテンプレート構文
__cpp_impl_coroutine 201902L コルーチン
__cpp_impl_destroying_delete 201806L 可変長データを扱うクラスの効率的なdelete
__cpp_impl_three_way_comparison 201907L 一貫比較
__cpp_init_captures 201803L ラムダ式の初期化キャプチャでのパック展開を許可
__cpp_modules 201907L モジュール
__cpp_nontype_template_args 201911L 非型テンプレートパラメータとしてクラス型を許可する
__cpp_using_enum 201907L スコープ付き列挙型のusing宣言

ライブラリ

ライブラリの機能テストマクロは全て<version>でも提供される。

マクロ名 機能 ヘッダ
__cpp_lib_array_constexpr 201803L
201806L
201811L
std::arrayの完全constexpr対応 <iterator>
<array>
__cpp_lib_assume_aligned 201811L std::assume_aligned() <memory>
__cpp_lib_atomic_flag_test 201907L std::atomic_flag::test() <atomic>
__cpp_lib_atomic_float 201711L std::atomicの浮動小数点数型に対する特殊化 <atomic>
__cpp_lib_atomic_lock_free_type_aliases 201907L atomic_signed_lock_free/atomic_unsigned_lock_free <atomic>
__cpp_lib_atomic_ref 201806L std::atomic_ref <atomic>
__cpp_lib_atomic_shared_ptr 201711L std::atomicstd::shared_ptr/std::weak_ptrに対する特殊化 <memory>
__cpp_lib_atomic_value_initialization 201911L std::atomic_flagの値初期化 <atomic>
<memory>
__cpp_lib_atomic_wait 201907L std::atomic::wait()std::atomic::notify_one()std::atomic::notify_all() <atomic>
__cpp_lib_barrier 201907L <barrier>の追加 <barrier>
__cpp_lib_bind_front 201811L
201907L
std::bind_front() <functional>
__cpp_lib_bit_cast 201806L std::bit_cast() <bit>
__cpp_lib_bitops 201907L <bit>の追加 <bit>
__cpp_lib_bounded_array_traits 201902L std::is_bounded_arraystd::is_unbounded_array <type_traits>
__cpp_lib_char8_t 201811L
201907L
char8_tに対する特殊化の追加 <atomic>
<filesystem>
<istream>
<limits>
<locale>
<ostream>
<string>
<string_view>
__cpp_lib_chrono 201907L カレンダーとタイムゾーン <chrono>
__cpp_lib_concepts 202002L <concepts>の追加 <concepts>
__cpp_lib_constexpr_algorithms 201806L 多くのアルゴリズムにconstexprを追加 <algorithm>
__cpp_lib_constexpr_complex 201711L std::complexconstexpr対応 <complex>
__cpp_lib_constexpr_dynamic_alloc 201907L std::destroy_atファミリとstd::allocator/std::alocator_traitsconstexpr対応
std::construct_at
<memory>
__cpp_lib_constexpr_functional 201907L std::invokestd::reference_wrapperstd::not_fnstd::bind_frontstd::bindstd::mem_fnconstexpr対応 <functional>
__cpp_lib_constexpr_iterator 201811L back_insert_iteratorfront_insert_iteratorinsert_iteratorconstexpr対応 <iterator>
__cpp_lib_constexpr_memory 201811L std::pointer_traitsconstexpr対応 <memory>
__cpp_lib_constexpr_numeric 201911L <numeric>の数値アルゴリズムのconstexpr対応 <numeric>
__cpp_lib_constexpr_string 201907L std::stringconstexpr対応 <string>
__cpp_lib_constexpr_string_view 201811L std::string_view::copyconstexpr対応 <string_view>
__cpp_lib_constexpr_tuple 201811L std::tupleconstexpr追加対応(一部のコンストラクタと代入演算子) <tuple>
__cpp_lib_constexpr_utility 201811L std::pairconstexpr追加対応(一部のコンストラクタと代入演算子) <utility>
__cpp_lib_constexpr_vector 201907L std::vectorconstexpr対応 <vector>
__cpp_lib_coroutine 201902L <coroutine>ヘッダの追加 <coroutine>
__cpp_lib_destroying_delete 201806L std::destroying_delete_t <new>
__cpp_lib_endian 201907L std::endian <bit>
__cpp_lib_erase_if 202002L 各コンテナに対するstd::erasestd::erase_ifの特殊化 <string>
<deque>
<forward_list>
<list>
<vector>
<map>
<set>
<unordered_map>
<unordered_set>
__cpp_lib_execution 201902L std::execution::unsequenced_policy <execution>
__cpp_lib_format 201907L
202106L
202110L
<format>ヘッダ
コンパイル時フォーマット文字列検査/std::vformatのコードサイズ削減
std::chronoのフォーマットにおけるロケール指定の修正/constだとフォーマットできない型に対する対応
<format>
__cpp_lib_generic_unordered_lookup 201811L 非順序連想コンテナのfind(), count(), contains(), equal_range()に対するHeterogeneous Overload追加 <unordered_map>
<unordered_set>
__cpp_lib_int_pow2 202002L <bit>の2の冪乗に関する操作を行う関数の名前変更 <bit>
__cpp_lib_integer_comparison_functions 202002L std::cmp_equal()等の整数比較関数とstd::in_range() <utility>
__cpp_lib_interpolate 201902L std::lerp()std::midpoint() <cmath>
<numeric>
__cpp_lib_is_constant_evaluated 201811L std::is_constant_evaluated() <type_traits>
__cpp_lib_is_layout_compatible 201907L std::is_layout_compatibleis_corresponding_member <type_traits>
__cpp_lib_is_nothrow_convertible 201806L std::is_nothrow_convertible <type_traits>
__cpp_lib_is_pointer_interconvertible 201907L std::is_corresponding_memberstd::is_pointer_interconvertible_base_of <type_traits>
__cpp_lib_jthread 201911L std::jthreadstop_tokenによる協調的キャンセル機構 <stop_token>
<thread>
__cpp_lib_latch 201907L std::latch <latch>
__cpp_lib_list_remove_return_type 201806L std::liststd::forward_listremove(), remove_if(), unique()の戻り値型変更 <forward_list>
<list>
__cpp_lib_math_constants 201907L 数学定数 <numbers>
__cpp_lib_polymorphic_allocator 201902L std::pmr::polymorphic_allocatorの改修 <memory>
__cpp_lib_ranges 201911L
202106L
202110L
RangeライブラリとRangeアルゴリズム
viewコンセプトのデフォルト構築要求を削除
所有権を持つviewの許可とowning_view
<algorithm>
<functional>
<iterator>
<memory>
<ranges>
__cpp_lib_remove_cvref 201711L std::remove_cvref <type_traits>
__cpp_lib_semaphore 201907L std::counting_semaphorestd::binary_semaphore <semaphore>
__cpp_lib_shared_ptr_arrays 201707L std::make_sharedstd::allocate_sharedの配列対応 <memory>
__cpp_lib_shift 201806L std::shift_leftstd::shift_right <algorithm>
__cpp_lib_smart_ptr_for_overwrite 202002L std::make_shared_for_overwrite()std::allocate_shared_for_overwrite() <memory>
__cpp_lib_source_location 201907L std::source_location <source_location>
__cpp_lib_span 202002L std::span <span>
__cpp_lib_ssize 201902L std::ssize()std::spanで使用する整数型の符号なし(size_t)への変更 <iterator>
__cpp_lib_starts_ends_with 201711L std::stringstd::string_viewstarts_with()ends_with() <string>
<string_view>
__cpp_lib_string_view 201803L std::stringstd::string_viewのイテレータのconstexpr対応 <string>
<string_view>
__cpp_lib_syncbuf 201803L 同期化出力ストリーム(std::osyncstream)とバッファ(std::syncbuf <syncstream>
__cpp_lib_three_way_comparison 201907L 標準ライブラリの三方比較演算子対応 <compare>
__cpp_lib_to_address 201711L std::to_address() <memory>
__cpp_lib_to_array 201907L std::to_array() <array>
__cpp_lib_type_identity 201806L std::type_identity <type_traits>
__cpp_lib_unwrap_ref 201811L std::unwrap_referencestd::unwrap_ref_decay <type_traits>

参照