|
|
(36 intermediate revisions by 7 users not shown) |
Line 1: |
Line 1: |
− | {{title|Library feature-test macros {{mark c++20}}}} | + | {{title|Library feature-test macros {{mark since c++20}}}} |
| {{cpp/utility/navbar}} | | {{cpp/utility/navbar}} |
| | | |
| Each of following macros is defined if the header {{header|version}} or one of the corresponding headers specified in the table is included. | | Each of following macros is defined if the header {{header|version}} or one of the corresponding headers specified in the table is included. |
| | | |
− | {| class="wikitable sortable" | + | {{include editlink|cpp/utility/feature test}} |
− | |-
| + | |
− | ! Macro name
| + | |
− | ! Value
| + | |
− | ! Header
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_addressof_constexpr}}
| + | |
− | | 201603L
| + | |
− | | {{header|memory}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_allocator_traits_is_always_equal}}
| + | |
− | | 201411L
| + | |
− | | {{header|memory}} {{header|scoped_allocator}} {{header|string}} {{header|deque}} {{header|forward_list}} {{header|list}} {{header|vector}} {{header|map}} {{header|set}} {{header|unordered_map}} {{header|unordered_set}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_any}}
| + | |
− | | 201606L
| + | |
− | | {{header|any}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_apply}}
| + | |
− | | 201603L
| + | |
− | | {{header|tuple}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_array_constexpr}}
| + | |
− | | 201603L
| + | |
− | | {{header|iterator}} {{header|array}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_as_const}}
| + | |
− | | 201510L
| + | |
− | | {{header|utility}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_atomic_is_always_lock_free}}
| + | |
− | | 201603L
| + | |
− | | {{header|atomic}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_atomic_ref}}
| + | |
− | | 201806L
| + | |
− | | {{header|atomic}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_bit_cast}}
| + | |
− | | 201806L
| + | |
− | | {{header|bit}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_bind_front}}
| + | |
− | | 201811L
| + | |
− | | {{header|functional}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_bool_constant}}
| + | |
− | | 201505L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_boyer_moore_searcher}}
| + | |
− | | 201603L
| + | |
− | | {{header|functional}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_byte}}
| + | |
− | | 201603L
| + | |
− | | {{header|cstddef}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_char8_t}}
| + | |
− | | 201811L
| + | |
− | | {{header|atomic}} {{header|filesystem}} {{header|istream}} {{header|limits}} {{header|locale}} {{header|ostream}} {{header|string}} {{header|string_view}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_chrono}}
| + | |
− | | 201611L
| + | |
− | | {{header|chrono}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_clamp}}
| + | |
− | | 201603L
| + | |
− | | {{header|algorithm}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_complex_udls}}
| + | |
− | | 201309L
| + | |
− | | {{header|complex}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_concepts}}
| + | |
− | | 201806L
| + | |
− | | {{header|concepts}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_constexpr_misc}}
| + | |
− | | 201811L
| + | |
− | | {{header|array}} {{header|functional}} {{header|iterator}} {{header|string_view}} {{header|tuple}} {{header|utility}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_constexpr_swap_algorithms}}
| + | |
− | | 201806L
| + | |
− | | {{header|algorithm}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_enable_shared_from_this}}
| + | |
− | | 201603L
| + | |
− | | {{header|memory}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_erase_if}}
| + | |
− | | 201811L
| + | |
− | | {{header|string}} {{header|deque}} {{header|forward_list}} {{header|list}} {{header|vector}} {{header|map}} {{header|set}} {{header|unordered_map}} {{header|unordered_set}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_exchange_function}}
| + | |
− | | 201304L
| + | |
− | | {{header|utility}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_execution}}
| + | |
− | | 201603L
| + | |
− | | {{header|execution}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_filesystem}}
| + | |
− | | 201703L
| + | |
− | | {{header|filesystem}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_gcd_lcm}}
| + | |
− | | 201606L
| + | |
− | | {{header|numeric}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_generic_associative_lookup}}
| + | |
− | | 201304L
| + | |
− | | {{header|map}} {{header|set}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_generic_unordered_lookup}}
| + | |
− | | 201811L
| + | |
− | | {{header|unordered_map}} {{header|unordered_set}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_hardware_interference_size}}
| + | |
− | | 201703L
| + | |
− | | {{header|new}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_has_unique_object_representations}}
| + | |
− | | 201606L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_hypot}}
| + | |
− | | 201603L
| + | |
− | | {{header|cmath}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_incomplete_container_elements}}
| + | |
− | | 201505L
| + | |
− | | {{header|forward_list}} {{header|list}} {{header|vector}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_integer_sequence}}
| + | |
− | | 201304L
| + | |
− | | {{header|utility}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_integral_constant_callable}}
| + | |
− | | 201304L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_invoke}}
| + | |
− | | 201411L
| + | |
− | | {{header|functional}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_is_constant_evaluated}}
| + | |
− | | 201811L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_is_aggregate}}
| + | |
− | | 201703L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_is_final}}
| + | |
− | | 201402L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_is_invocable}}
| + | |
− | | 201703L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_is_null_pointer}}
| + | |
− | | 201309L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_is_swappable}}
| + | |
− | | 201603L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_launder}}
| + | |
− | | 201606L
| + | |
− | | {{header|new}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_list_remove_return_type}}
| + | |
− | | 201806L
| + | |
− | | {{header|forward_list}} {{header|list}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_logical_traits}}
| + | |
− | | 201510L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_make_from_tuple}}
| + | |
− | | 201606L
| + | |
− | | {{header|tuple}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_make_reverse_iterator}}
| + | |
− | | 201402L
| + | |
− | | {{header|iterator}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_make_unique}}
| + | |
− | | 201304L
| + | |
− | | {{header|memory}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_map_try_emplace}}
| + | |
− | | 201411L
| + | |
− | | {{header|map}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_math_special_functions}}
| + | |
− | | 201603L
| + | |
− | | {{header|cmath}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_memory_resource}}
| + | |
− | | 201603L
| + | |
− | | {{header|memory_resource}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_node_extract}}
| + | |
− | | 201606L
| + | |
− | | {{header|map}} {{header|set}} {{header|unordered_map}} {{header|unordered_set}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_nonmember_container_access}}
| + | |
− | | 201411L
| + | |
− | | {{header|iterator}} {{header|array}} {{header|deque}} {{header|forward_list}} {{header|list}} {{header|map}} {{header|regex}} {{header|set}} {{header|string}} {{header|unordered_map}} {{header|unordered_set}} {{header|vector}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_not_fn}}
| + | |
− | | 201603L
| + | |
− | | {{header|functional}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_null_iterators}}
| + | |
− | | 201304L
| + | |
− | | {{header|iterator}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_optional}}
| + | |
− | | 201606L
| + | |
− | | {{header|optional}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_parallel_algorithm}}
| + | |
− | | 201603L
| + | |
− | | {{header|algorithm}} {{header|numeric}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_quoted_string_io}}
| + | |
− | | 201304L
| + | |
− | | {{header|iomanip}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_ranges}}
| + | |
− | | 201811L
| + | |
− | | {{header|algorithm}} {{header|functional}} {{header|iterator}} {{header|memory}} {{header|ranges}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_raw_memory_algorithms}}
| + | |
− | | 201606L
| + | |
− | | {{header|memory}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_result_of_sfinae}}
| + | |
− | | 201210L
| + | |
− | | {{header|functional}} {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_robust_nonmodifying_seq_ops}}
| + | |
− | | 201304L
| + | |
− | | {{header|algorithm}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_sample}}
| + | |
− | | 201603L
| + | |
− | | {{header|algorithm}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_scoped_lock}}
| + | |
− | | 201703L
| + | |
− | | {{header|mutex}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_shared_mutex}}
| + | |
− | | 201505L
| + | |
− | | {{header|shared_mutex}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_shared_ptr_arrays}}
| + | |
− | | 201611L
| + | |
− | | {{header|memory}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_shared_ptr_weak_type}}
| + | |
− | | 201606L
| + | |
− | | {{header|memory}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_shared_timed_mutex}}
| + | |
− | | 201402L
| + | |
− | | {{header|shared_mutex}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_string_udls}}
| + | |
− | | 201304L
| + | |
− | | {{header|string}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_string_view}}
| + | |
− | | 201606L
| + | |
− | | {{header|string}} {{header|string_view}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_three_way_comparison}}
| + | |
− | | 201711L
| + | |
− | | {{header|compare}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_to_chars}}
| + | |
− | | 201611L
| + | |
− | | {{header|utility}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_transformation_trait_aliases}}
| + | |
− | | 201304L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_transparent_operators}}
| + | |
− | | 201510L
| + | |
− | | {{header|memory}} {{header|functional}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_tuple_element_t}}
| + | |
− | | 201402L
| + | |
− | | {{header|tuple}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_tuples_by_type}}
| + | |
− | | 201304L
| + | |
− | | {{header|utility}} {{header|tuple}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_type_trait_variable_templates}}
| + | |
− | | 201510L
| + | |
− | | {{header|type_traits}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_uncaught_exceptions}}
| + | |
− | | 201411L
| + | |
− | | {{header|exception}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_unordered_map_try_emplace}}
| + | |
− | | 201411L
| + | |
− | | {{header|unordered_map}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_variant}}
| + | |
− | | 201606L
| + | |
− | | {{header|variant}}
| + | |
− | |-
| + | |
− | | {{tt|__cpp_lib_void_t}}
| + | |
− | | 201411L
| + | |
− | | {{header|type_traits}}
| + | |
− | |}
| + | |
| | | |
− | {{langlinks|ja|zh}} | + | {{cpp/utility/feature test}} |
| + | |
| + | ===Notes=== |
| + | Each value in "Value" column follows the pattern: {{c/core|"yyyymmL"}}, where {{c/core|"yyyy"}} is a year, and {{c/core|"mm"}} is a month when the corresponding feature-set was accepted for standardization. Some values where increased since the time of their introduction, if capabilities of given feature where extended. The table above contains only the most recent values (that is, taken from the latest C++ language draft standard). A full set of values, including the initial and intermediate ones, can be found in [[cpp/feature test#Library features|this table]]. |
| + | |
| + | ===See also=== |
| + | {{dsc begin}} |
| + | {{dsc|[[cpp/feature_test|'''Feature testing''']] {{mark c++20}}|A set of preprocessor macros to test the corresponding to C++ language and library features}} |
| + | {{dsc see cpp|cpp/freestanding#Requirements on standard library headers|Headers required for a freestanding implementation|nomono=true}} |
| + | {{dsc see cpp|cpp/preprocessor/replace#Predefined macros|Predefined Macro Symbols|nomono=true}} |
| + | {{dsc end}} |
| + | |
| + | {{langlinks|es|ja|ru|zh}} |