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

履歴 編集

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

概要

SD-6 は C++17 の機能について以下のテストマクロを定義することを推奨している:

言語機能

マクロ名 機能
__cpp_hex_float 201603 十六進浮動小数点数リテラル
__cpp_inline_variables 201606 インライン変数
__cpp_aligned_new 201606 アライメント指定されたデータの動的メモリ確保
__cpp_guaranteed_copy_elision 201606 値のコピー省略を保証
__cpp_noexcept_function_type 201510 例外仕様を型システムの一部にする
__cpp_fold_expressions 201411 畳み込み式
__cpp_constexpr 201603 constexprラムダ
__cpp_if_constexpr 201606 if constexpr
__cpp_range_based_for 201603 範囲 for ループの制限緩和
__cpp_static_assert 201411 static_assert のメッセージ省略を許可
__cpp_deduction_guides 201606
201611
クラステンプレートのテンプレート引数推論
__cpp_nontype_template_parameter_auto 201606 非型テンプレートパラメータのauto宣言
__cpp_namespace_attributes 201411 名前空間への属性付加を許可
__cpp_enumerator_attributes 201411 列挙子への属性付加を許可
__cpp_inheriting_constructors 201511 継承コンストラクタの新仕様
__cpp_variadic_using 201611 using宣言のパック展開
__has_cpp_attribute(fallthrough) true [[fallthrough]]属性
__has_cpp_attribute(nodiscard) true [[nodiscard]]属性
__has_cpp_attribute(maybe_unused) true [[maybe_unused]]属性
__cpp_structured_bindings 201606 構造化束縛
__cpp_aggregate_bases 201603 集成体初期化の拡張
__cpp_nontype_template_args 201411 非型テンプレートパラメータの定数式を評価
__cpp_nested_namespace_definitions 201411 入れ子名前空間の定義

ライブラリ

マクロ名 機能 ヘッダ
__cpp_lib_byte 201603 std::byte <cstddef>
__cpp_lib_hardware_interference_size 201703 std::hardware_destructive_interference_sizestd::hardware_constructive_interference_size <new>
__cpp_lib_launder 201606 std::launder()
__cpp_lib_uncaught_exceptions 201411 std::uncaught_exceptions() <exception>
__cpp_lib_as_const 201510 std::as_const() <utility>
__cpp_lib_make_from_tuple 201606 std::make_from_tuple() <utility>
__cpp_lib_apply 201603 std::apply() <tuple>
__cpp_lib_optional 201606 std::optional <optional>
__cpp_lib_any 201606 std::any <any>
__cpp_lib_variant 201606 std::variant <variant>
__cpp_lib_memory_resource 201603 std::memory_resourceと関連する機能 <memory_resource>
__cpp_lib_boyer_moore_searcher 201603 std::boyer_morre_searcherと関連する機能 <functional>
__cpp_lib_string_view 201606 std::string_view <string_view>
__cpp_lib_sample 201603 std::sample() <algorithm>
__cpp_lib_addressof_constexpr 201603 std::addressof() <memory>
__cpp_lib_raw_memory_algorithms 201606 std::uninitialized_default_construct()と関連する機能 <memory>
__cpp_lib_transparent_operators 201510 std::owner_less の柔軟性向上 <functional>
<memory>
__cpp_lib_enable_shared_from_this 201603 std::enable_shared_from_this <memory>
__cpp_lib_shared_ptr_weak_type 201606 std::shared_ptrクラスのメンバ型weak_type <memory>
__cpp_lib_shared_ptr_arrays 201611 std::shared_ptrクラスの配列サポート <memory>
__cpp_lib_invoke 201411 std::invoke() <functional>
__cpp_lib_not_fn 201603 std::not_fn() <functional>
__cpp_lib_void_t 201411 std::void_t <type_traits>
__cpp_lib_bool_constant 201505 std::bool_constant <type_traits>
__cpp_lib_type_trait_variable_templates 201510 型トレイト変数テンプレート (some_trait_v<T> = some_trait<T>::value) <type_traits>
__cpp_lib_logical_traits 201510 論理演算子型トレイト (std::conjunction, std::disjunction, std::negation) <type_traits>
__cpp_lib_is_swappable 201603 std::is_swappableと関連する機能 <type_traits>
__cpp_lib_is_invocable 201703 std::is_invocableと関連する機能 <type_traits>
__cpp_lib_has_unique_object_representations 201606 std::has_unique_object_representations <type_traits>
__cpp_lib_is_aggregate 201703 std::is_aggregate <type_traits>
__cpp_lib_chrono 201510 <chrono> の改良 <chrono>
__cpp_lib_execution 201603 <execution> の追加 <execution>
__cpp_lib_parallel_algorithm 201603 並列アルゴリズム <algorithm>
<numeric>
<memory>
__cpp_lib_to_chars 201611 std::to_chars()std::from_chars() <charconv>
__cpp_lib_allocator_traits_is_always_equal 201411 ライブラリ内の noexcept のクリーンアップ <deque>
<forward_list>
<list>
<map>
<memory>
<scoped_allocator>
<set>
<string>
<unordered_map>
<unordered_set>
<vector>
__cpp_lib_incomplete_container_elements 201505 標準コンテナについて不完全型を最小限サポート <forward_list>
<list>
<vector>
__cpp_lib_map_try_emplace 201411 std::map::try_emplace(), std::map::insert_or_assign() <map>
__cpp_lib_unordered_map_try_emplace 201411 std::unordered_map::try_emplace(), std::unordered_map::insert_or_assign() <unordered_map>
__cpp_lib_node_extract 201606 連想コンテナのsplice <map>
<set>
<unordered_map>
<unordered_set>
__cpp_lib_array_constexpr 201603 配列関係のランダムアクセスにconstexprを追加 <array>, <iterator>
__cpp_lib_nonmember_container_access 201411 非メンバ関数 std::size(), std::empty(), std::data() <iterator>
__cpp_lib_clamp 201603 std::clamp() <algorithm>
__cpp_lib_gcd_lcm 201606 std::gcd()std::lcm() <numeric>
__cpp_lib_hypot 201603 3引数版のstd::hypot() <cmath>
__cpp_lib_math_special_functions 201603 数学の特殊関数 <cmath>
__cpp_lib_filesystem 201703 ファイルシステムライブラリ <filesystem>
__cpp_lib_atomic_is_always_lock_free 201603 std::atomicクラスの静的メンバ定数is_always_lock_free <atomic>
__cpp_lib_shared_mutex 201505 std::shared_mutex <shared_mutex>
__cpp_lib_scoped_lock 201703 可変個のミューテックスのロックを管理するstd::scoped_lock <mutex>

参照