ÐакÑоÑÑ Ð¿ÑовеÑки возможноÑÑей (C++20)
СÑандаÑÑ Ð¾Ð¿ÑеделÑÐµÑ Ð½Ð°Ð±Ð¾Ñ Ð¼Ð°ÐºÑоÑов пÑепÑоÑеÑÑоÑа, ÑооÑвеÑÑÑвÑÑÑÐ¸Ñ ÑзÑÐºÑ C++ и возможноÑÑÑм библиоÑеки, пÑедÑÑавленнÑм в C++11 или новее. Ðни пÑедназнаÑÐµÐ½Ñ ÐºÐ°Ðº пÑоÑÑой и поÑÑабелÑнÑй ÑпоÑоб пÑовеÑки налиÑÐ¸Ñ ÑказаннÑÑ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑей.
СодеÑжание |
[пÑавиÑÑ] ÐÑÑибÑÑÑ
__has_cpp_attribute( маÑкеÑ-аÑÑибÑÑа )
|
|||||||||
ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие аÑÑибÑÑа Ñ Ð¸Ð¼ÐµÐ½ÐµÐ¼ маÑкеÑ-аÑÑибÑÑа (поÑле ÑаÑкÑÑÑÐ¸Ñ Ð¼Ð°ÐºÑоÑа).
ÐÐ»Ñ ÑÑандаÑÑнÑÑ Ð°ÑÑибÑÑов он бÑÐ´ÐµÑ ÑаÑÑиÑен до года и меÑÑÑа, когда аÑÑибÑÑ Ð±Ñл добавлен в ÑабоÑий ÑеÑновик (ÑмоÑÑиÑе ÑаблиÑÑ Ð½Ð¸Ð¶Ðµ), налиÑие аÑÑибÑÑов, завиÑÑÑÐ¸Ñ Ð¾Ñ Ð¿Ð¾ÑÑавÑика, опÑеделÑеÑÑÑ Ð½ÐµÐ½ÑлевÑм знаÑением.
__has_cpp_attribute
можно ÑазложиÑÑ Ð½Ð° вÑÑажение
#if и
#elif.
Ðн ÑаÑÑмаÑÑиваеÑÑÑ ÐºÐ°Ðº опÑеделÑннÑй макÑÐ¾Ñ Ð´Ð»Ñ
#ifdef,
#ifndef и defined, но не Ð¼Ð¾Ð¶ÐµÑ Ð±ÑÑÑ Ð¸ÑполÑзован где-либо еÑе.
маÑкеÑ-аÑÑибÑÑа | ÐÑÑибÑÑ | ÐнаÑение | СÑандаÑÑ |
---|---|---|---|
carries_dependency
|
[[carries_dependency]]
|
200809L | (C++11) |
deprecated
|
[[deprecated]]
|
201309L | (C++14) |
fallthrough
|
[[fallthrough]]
|
201603L | (C++17) |
likely
|
[[likely]]
|
201803L | (C++20) |
maybe_unused
|
[[maybe_unused]]
|
201603L | (C++17) |
no_unique_address
|
[[no_unique_address]]
|
201803L | (C++20) |
nodiscard
|
[[nodiscard]]
|
201603L | (C++17) |
201907L | (C++20) | ||
noreturn
|
[[noreturn]]
|
200809L | (C++11) |
unlikely
|
[[unlikely]]
|
201803L | (C++20) |
[пÑавиÑÑ] ÐозможноÑÑи ÑзÑка
СледÑÑÑие макÑоÑÑ Ð¿ÑедопÑÐµÐ´ÐµÐ»ÐµÐ½Ñ Ð² каждой единиÑе ÑÑанÑлÑÑии. ÐаждÑй макÑÐ¾Ñ ÑаÑÑиÑÑеÑÑÑ Ð´Ð¾ ÑелоÑиÑленного лиÑеÑала, ÑооÑвеÑÑÑвÑÑÑего Ð³Ð¾Ð´Ñ Ð¸ меÑÑÑÑ, когда ÑооÑвеÑÑÑвÑÑÑÐ°Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑ Ð±Ñла вклÑÑена в ÑабоÑий ÑеÑновик.
Ðогда возможноÑÑÑ Ð·Ð½Ð°ÑиÑелÑно измениÑÑÑ, макÑÐ¾Ñ Ð±ÑÐ´ÐµÑ Ð¾Ð±Ð½Ð¾Ð²Ð»Ñн ÑооÑвеÑÑÑвÑÑÑим обÑазом.
ÐÐ¼Ñ Ð¼Ð°ÐºÑоÑа | ÐозможноÑÑÑ | ÐнаÑение | СÑд |
---|---|---|---|
__cpp_aggregate_bases | ÐгÑегиÑование клаÑÑов Ñ Ð±Ð°Ð·Ð¾Ð²Ñми клаÑÑами | 201603L | (C++17) |
__cpp_aggregate_nsdmi | ÐгÑегиÑование клаÑÑов Ñ Ð¸Ð½Ð¸ÑиализаÑоÑами ÑлеменÑов по ÑмолÑÐ°Ð½Ð¸Ñ | 201304L | (C++14) |
__cpp_aggregate_paren_init | ÐгÑегиÑÐ¾Ð²Ð°Ð½Ð½Ð°Ñ Ð¸Ð½Ð¸ÑиализаÑÐ¸Ñ Ð² ÑоÑме пÑÑмой иниÑиализаÑии | 201902L | (C++20) |
__cpp_alias_templates | Ð¨Ð°Ð±Ð»Ð¾Ð½Ñ Ð¿Ñевдонимов | 200704L | (C++11) |
__cpp_aligned_new | ÐинамиÑеÑкое вÑделение памÑÑи Ð´Ð»Ñ Ð´Ð°Ð½Ð½ÑÑ Ñ Ð½ÐµÑÑандаÑÑнÑм вÑÑавниванием | 201606L | (C++17) |
__cpp_attributes | ÐÑÑибÑÑÑ | 200809L | (C++11) |
__cpp_binary_literals | ÐвоиÑнÑе лиÑеÑÐ°Ð»Ñ | 201304L | (C++14) |
__cpp_capture_star_this | ÐÑмбда-Ð·Ð°Ñ Ð²Ð°Ñ *this по знаÑÐµÐ½Ð¸Ñ ÐºÐ°Ðº [=,*this] | 201603L | (C++17) |
__cpp_char8_t | char8_t | 201811L | (C++20) |
__cpp_concepts | ÐонÑепÑÑ | 201907L | (C++20) |
__cpp_conditional_explicit | explicit(bool) |
201806L | (C++20) |
__cpp_consteval | Ðемедленно вÑполнÑемÑе ÑÑнкÑии | 201811L | (C++20) |
__cpp_constexpr | constexpr | 200704L | (C++11) |
ÐÑлабленнÑй constexpr , не-const constexpr меÑÐ¾Ð´Ñ |
201304L | (C++14) | |
Constexpr лÑмбда | 201603L | (C++17) | |
ТÑивиалÑнÑй иниÑиализаÑÐ¸Ñ Ð¿Ð¾ ÑмолÑÐ°Ð½Ð¸Ñ Ð¸ обÑÑвление asm в constexpr ÑÑнкÑиÑÑ | 201907L | (C++20) | |
__cpp_constexpr_dynamic_alloc | ÐпеÑаÑии Ð´Ð»Ñ Ð´Ð¸Ð½Ð°Ð¼Ð¸ÑеÑкой длиÑелÑноÑÑи Ñ ÑÐ°Ð½ÐµÐ½Ð¸Ñ Ð² constexpr ÑÑнкÑиÑÑ | 201907L | (C++20) |
__cpp_constexpr_in_decltype | Создание опÑеделений ÑÑнкÑий и пеÑеменнÑÑ , когда они Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ñ Ð´Ð»Ñ Ð²ÑÑиÑÐ»ÐµÐ½Ð¸Ñ ÐºÐ¾Ð½ÑÑанÑÑ | 201711L | (C++20) |
__cpp_constinit | constinit | 201907L | (C++20) |
__cpp_decltype | decltype | 200707L | (C++11) |
__cpp_decltype_auto | ÐÑвод Ñипа возвÑаÑаемого знаÑÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð¾Ð±ÑÑнÑÑ ÑÑнкÑий | 201304L | (C++14) |
__cpp_deduction_guides | ÐÑвод аÑгÑменÑов Ñаблона Ð´Ð»Ñ Ñаблонов клаÑÑов | 201703L | (C++17) |
CTAD Ð´Ð»Ñ Ð°Ð³ÑегаÑов и пÑевдонимов | 201907L | (C++20) | |
__cpp_delegating_constructors | ÐелегиÑование конÑÑÑÑкÑоÑов | 200604L | (C++11) |
__cpp_designated_initializers | ÐазнаÑеннÑй иниÑиализаÑÐ¾Ñ | 201707L | (C++20) |
__cpp_enumerator_attributes | ÐÑÑибÑÑÑ Ð´Ð»Ñ Ð½ÑмеÑаÑоÑов | 201411L | (C++17) |
__cpp_fold_expressions | ÐÑÑÐ°Ð¶ÐµÐ½Ð¸Ñ ÑвÑÑÑки | 201603L | (C++17) |
__cpp_generic_lambdas | ÐбÑие лÑмбда-вÑÑÐ°Ð¶ÐµÐ½Ð¸Ñ | 201304L | (C++14) |
ÐнакомÑй ÑинÑакÑÐ¸Ñ Ñаблона Ð´Ð»Ñ Ð¾Ð±ÑÐ¸Ñ Ð»Ñмбд | 201707L | (C++20) | |
__cpp_guaranteed_copy_elision | ÐаÑанÑиÑованнÑй пÑопÑÑк копиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð·Ð° ÑÑÑÑ ÑпÑоÑÑнной каÑегоÑии знаÑений | 201606L | (C++17) |
__cpp_hex_float | ШеÑÑнадÑаÑеÑиÑнÑе лиÑеÑÐ°Ð»Ñ Ñ Ð¿Ð»Ð°Ð²Ð°ÑÑей запÑÑой | 201603L | (C++17) |
__cpp_if_consteval | consteval if |
202106L | (C++23) |
__cpp_if_constexpr | constexpr if |
201606L | (C++17) |
__cpp_impl_coroutine | СопÑогÑÐ°Ð¼Ð¼Ñ (поддеÑжка компилÑÑоÑом) | 201902L | (C++20) |
__cpp_impl_destroying_delete | УниÑÑожаÑÑий опеÑаÑÐ¾Ñ delete (поддеÑжка компилÑÑоÑом) | 201806L | (C++20) |
__cpp_impl_three_way_comparison | ТÑÑÑ ÑÑоÑоннее ÑÑавнение (поддеÑжка компилÑÑоÑом) | 201907L | (C++20) |
__cpp_inheriting_constructors | ÐаÑледование конÑÑÑÑкÑоÑов | 200802L | (C++11) |
ÐеÑеделка наÑледÑемÑÑ ÐºÐ¾Ð½ÑÑÑÑкÑоÑов | 201511L | (C++17) | |
__cpp_init_captures | ÐÐ°Ñ Ð²Ð°Ñ Ð¿Ñи иниÑиализаÑии лÑмбда | 201304L | (C++14) |
РазÑеÑено ÑаÑÑиÑение пакеÑа в Ð·Ð°Ñ Ð²Ð°Ñе пÑи иниÑиализаÑии лÑмбда | 201803L | (C++20) | |
__cpp_initializer_lists | СпиÑок иниÑиализаÑии и std::initializer_list | 200806L | (C++11) |
__cpp_inline_variables | ÐÑÑÑоеннÑе пеÑеменнÑе | 201606L | (C++17) |
__cpp_lambdas | ÐÑмбда-вÑÑÐ°Ð¶ÐµÐ½Ð¸Ñ | 200907L | (C++11) |
__cpp_modules | ÐодÑли | 201907L | (C++20) |
__cpp_namespace_attributes | ÐÑÑибÑÑÑ Ð´Ð»Ñ Ð¿ÑоÑÑÑанÑÑв имÑн | 201411L | (C++17) |
__cpp_noexcept_function_type | СпеÑиÑикаÑии иÑклÑÑений ÑÐ´ÐµÐ»Ð°Ð½Ñ ÑаÑÑÑÑ ÑиÑÑÐµÐ¼Ñ Ñипов | 201510L | (C++17) |
__cpp_nontype_template_args | РазÑеÑено конÑÑанÑное вÑÑиÑление Ð´Ð»Ñ Ð²ÑÐµÑ Ð°ÑгÑменÑов Ñаблона, не оÑноÑÑÑиеÑÑ Ðº ÑÐ¸Ð¿Ñ | 201411L | (C++17) |
Ð¢Ð¸Ð¿Ñ ÐºÐ»Ð°ÑÑов и ÑÐ¸Ð¿Ñ Ñ Ð¿Ð»Ð°Ð²Ð°ÑÑей запÑÑой в аÑгÑменÑÐ°Ñ Ñаблона не ÑвлÑÑÑÐ¸Ñ ÑÑ Ñипами | 201911L | (C++20) | |
__cpp_nontype_template_parameter_auto | ÐбÑÑвление аÑгÑменÑов Ñаблона не ÑвлÑÑÑиеÑÑ Ñипами Ñ auto |
201606L | (C++17) |
__cpp_nsdmi | ÐниÑиализаÑоÑÑ Ð½ÐµÑÑаÑиÑеÑÐºÐ¸Ñ ÑлеменÑов даннÑÑ | 200809L | (C++11) |
__cpp_range_based_for | ÐÑнованнÑй на диапазоне Ñикл for |
200907L | (C++11) |
Цикл for на оÑнове диапазона Ñ ÑазнÑми наÑалÑнÑм /конеÑнÑм Ñипами |
201603L | (C++17) | |
__cpp_raw_strings | ÐеобÑабоÑаннÑе ÑÑÑоковÑе лиÑеÑÐ°Ð»Ñ | 200710L | (C++11) |
__cpp_ref_qualifiers | ÐвалиÑикаÑоÑÑ ÑÑÑлок | 200710L | (C++11) |
__cpp_return_type_deduction | ÐÑвод Ñипа возвÑаÑаемого знаÑÐµÐ½Ð¸Ñ Ð´Ð»Ñ Ð¾Ð±ÑÑнÑÑ ÑÑнкÑий | 201304L | (C++14) |
__cpp_rvalue_references | ÐÑавоÑÑоÑоннÑÑ ÑÑÑлка | 200610L | (C++11) |
__cpp_size_t_suffix | ÐиÑеÑалÑнÑе ÑÑÑÑикÑÑ Ð´Ð»Ñ size_t и ÐµÑ Ð·Ð½Ð°ÐºÐ¾Ð²Ð¾Ð¹ веÑÑии |
202011L | (C++23) |
__cpp_sized_deallocation | ÐÑвобождение памÑÑи по ÑазмеÑÑ | 201309L | (C++14) |
__cpp_static_assert | static_assert | 200410L | (C++11) |
Ðдно-аÑгÑменÑнÑй static_assert |
201411L | (C++17) | |
__cpp_structured_bindings | СÑÑÑкÑÑÑнÑе пÑивÑзки | 201606L | (C++17) |
__cpp_template_template_args | СооÑвеÑÑÑвие ÑаблоннÑм аÑгÑменÑам Ñаблона | 201611L | (C++17) |
__cpp_threadsafe_static_init | ÐинамиÑеÑÐºÐ°Ñ Ð¸Ð½Ð¸ÑиализаÑÐ¸Ñ Ð¸ ÑниÑÑожение Ñ ÐºÐ¾Ð½ÐºÑÑенÑией | 200806L | (C++11) |
__cpp_unicode_characters | ÐовÑе ÑимволÑнÑе ÑÐ¸Ð¿Ñ (char16_t и char32_t) | 200704L | (C++11) |
__cpp_unicode_literals | СÑÑоковÑе лиÑеÑÐ°Ð»Ñ Ð² Юникоде | 200710L | (C++11) |
__cpp_user_defined_literals | ÐолÑзоваÑелÑÑкие лиÑеÑÐ°Ð»Ñ | 200809L | (C++11) |
__cpp_using_enum | Using enum | 201907L | (C++20) |
__cpp_variable_templates | Ð¨Ð°Ð±Ð»Ð¾Ð½Ñ Ð¿ÐµÑеменнÑÑ | 201304L | (C++14) |
__cpp_variadic_templates | ÐаÑиаÑивнÑе ÑÐ°Ð±Ð»Ð¾Ð½Ñ | 200704L | (C++11) |
__cpp_variadic_using | РаÑÑиÑÐµÐ½Ð¸Ñ Ð¿Ð°ÐºÐµÑов в using -обÑÑвлении |
201611L | (C++17) |
[пÑавиÑÑ] ÐозможноÑÑи библиоÑеки
СледÑÑÑие макÑоÑÑ Ð¾Ð¿ÑеделенÑ, еÑли вклÑÑÑн заголовок <version> или лÑбой из ÑооÑвеÑÑÑвÑÑÑÐ¸Ñ Ð·Ð°Ð³Ð¾Ð»Ð¾Ð²ÐºÐ¾Ð² в ÑаблиÑе ниже. ÐаждÑй макÑÐ¾Ñ ÑаÑÑиÑÑеÑÑÑ Ð² ÑелоÑиÑленнÑй лиÑеÑал, ÑооÑвеÑÑÑвÑÑÑий Ð³Ð¾Ð´Ñ Ð¸ меÑÑÑÑ, когда ÑооÑвеÑÑÑвÑÑÑÐ°Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾ÑÑÑ Ð±Ñла вклÑÑена в ÑабоÑий ÑеÑновик.
Ðогда возможноÑÑÑ Ð·Ð½Ð°ÑиÑелÑно изменÑеÑÑÑ, макÑÐ¾Ñ Ð¾Ð±Ð½Ð¾Ð²Ð»ÑеÑÑÑ ÑооÑвеÑÑÑвÑÑÑим обÑазом.
ÐÐ¼Ñ Ð¼Ð°ÐºÑоÑа | ÐозможноÑÑÑ | ÐнаÑение | Ðаголовок | СÑд |
---|---|---|---|---|
__cpp_lib_addressof_constexpr | Constexpr std::addressof | 201603L | <memory> | (C++17) |
__cpp_lib_allocator_traits_is_always_equal | std::allocator_traits::is_always_equal | 201411L | <memory> <scoped_allocator> <string> <deque> <forward_list> <list> <vector> <map> <set> <unordered_map> <unordered_set> | (C++17) |
__cpp_lib_any | std::any | 201606L | <any> | (C++17) |
__cpp_lib_apply | std::apply | 201603L | <tuple> | (C++17) |
__cpp_lib_array_constexpr | Constexpr Ð´Ð»Ñ std::reverse_iterator, std::move_iterator, std::array и доÑÑÑпа в диапазоне | 201603L | <iterator> <array> | (C++17) |
ConstexprIterator; constexpr ÑÑавнение Ð´Ð»Ñ std::array; ÑазнÑе constexpr биÑÑ (std::array::fill и дÑÑгие) | 201811L | <iterator> <array> | (C++20) | |
__cpp_lib_as_const | std::as_const | 201510L | <utility> | (C++17) |
__cpp_lib_assume_aligned | std::assume_aligned | 201811L | <memory> | (C++20) |
__cpp_lib_atomic_flag_test | std::atomic_flag::test | 201907L | <atomic> | (C++20) |
__cpp_lib_atomic_float | ÐÑомаÑноÑÑÑ Ñ Ð¿Ð»Ð°Ð²Ð°ÑÑей ÑоÑкой | 201711L | <atomic> | (C++20) |
__cpp_lib_atomic_is_always_lock_free | constexpr atomic<T>::is_always_lock_free | 201603L | <atomic> | (C++17) |
__cpp_lib_atomic_lock_free_type_aliases | аÑомаÑнÑе ÑелоÑиÑленнÑе ÑÐ¸Ð¿Ñ Ð±ÐµÐ· блокиÑовок (std::atomic_signed_lock_free, std::atomic_unsigned_lock_free) | 201907L | <atomic> | (C++20) |
__cpp_lib_atomic_ref | std::atomic_ref | 201806L | <atomic> | (C++20) |
__cpp_lib_atomic_shared_ptr | std::atomic<std::shared_ptr> | 201711L | <memory> | (C++20) |
__cpp_lib_atomic_value_initialization | ÐÑпÑавление аÑомаÑной иниÑиализаÑии (иниÑиализаÑÐ¸Ñ Ð·Ð½Ð°ÑÐµÐ½Ð¸Ñ std::atomic по ÑмолÑаниÑ) | 201911L | <atomic> <memory> | (C++20) |
__cpp_lib_atomic_wait | ÐÑÑекÑивное std::atomic ожидание | 201907L | <atomic> | (C++20) |
__cpp_lib_barrier | std::barrier | 201907L | <barrier> | (C++20) |
__cpp_lib_bind_front | std::bind_front | 201907L | <functional> | (C++20) |
__cpp_lib_bit_cast | std::bit_cast | 201806L | <bit> | (C++20) |
__cpp_lib_bitops | ÐиÑовÑе опеÑаÑии | 201907L | <bit> | (C++20) |
__cpp_lib_bool_constant | std::bool_constant | 201505L | <type_traits> | (C++17) |
__cpp_lib_bounded_array_traits | std::is_bounded_array, std::is_unbounded_array | 201902L | <type_traits> | (C++20) |
__cpp_lib_boyer_moore_searcher | ÐлгоÑиÑÐ¼Ñ Ð¿Ð¾Ð¸Ñка | 201603L | <functional> | (C++17) |
__cpp_lib_byte | std::byte | 201603L | <cstddef> | (C++17) |
__cpp_lib_char8_t | ÐиблиоÑеÑÐ½Ð°Ñ Ð¿Ð¾Ð´Ð´ÐµÑжка Ð´Ð»Ñ char8_t | 201907L | <atomic> <filesystem> <istream> <limits> <locale> <ostream> <string> <string_view> | (C++20) |
__cpp_lib_chrono | ФÑнкÑии окÑÑÐ³Ð»ÐµÐ½Ð¸Ñ Ð´Ð»Ñ std::chrono::duration и std::chrono::time_point | 201510L | <chrono> | (C++17) |
Constexpr Ð´Ð»Ñ Ð²ÑÐµÑ ÑÑнкÑий-ÑлеменÑов std::chrono::duration и std::chrono::time_point | 201611L | <chrono> | (C++17) | |
ÐалендаÑи и ЧаÑовÑе ÐоÑÑа | 201907L | <chrono> | (C++20) | |
__cpp_lib_chrono_udls | ÐпÑеделÑемÑе полÑзоваÑелем лиÑеÑÐ°Ð»Ñ Ð´Ð»Ñ Ñипов вÑемени | 201304L | <chrono> | (C++14) |
__cpp_lib_clamp | std::clamp | 201603L | <algorithm> | (C++17) |
__cpp_lib_complex_udls | ÐолÑзоваÑелÑÑкие лиÑеÑÐ°Ð»Ñ Ð´Ð»Ñ std::complex |
201309L | <complex> | (C++14) |
__cpp_lib_concepts | ÐонÑепÑÑ ÑÑандаÑÑной библиоÑеки | 202002L | <concepts> | (C++20) |
__cpp_lib_constexpr_algorithms | Constexpr Ð´Ð»Ñ Ð°Ð»Ð³Ð¾ÑиÑмов | 201806L | <algorithm> | (C++20) |
__cpp_lib_constexpr_complex | Constexpr Ð´Ð»Ñ std::complex | 201711L | <complex> | (C++20) |
__cpp_lib_constexpr_dynamic_alloc | Constexpr Ð´Ð»Ñ std::allocator и ÑвÑзаннÑÑ ÑÑÐ¸Ð»Ð¸Ñ | 201907L | <memory> | (C++20) |
__cpp_lib_constexpr_functional | РазнÑе constexpr биÑÑ (std::default_searcher); constexpr INVOKE | 201907L | <functional> | (C++20) |
__cpp_lib_constexpr_iterator | РазнÑе constexpr биÑÑ (std::insert_iterator и дÑÑгие) | 201811L | <iterator> | (C++20) |
__cpp_lib_constexpr_memory | Constexpr в std::pointer_traits | 201811L | <memory> | (C++20) |
__cpp_lib_constexpr_numeric | Constexpr Ð´Ð»Ñ ÑиÑловÑÑ Ð°Ð»Ð³Ð¾ÑиÑмов | 201911L | <numeric> | (C++20) |
__cpp_lib_constexpr_string | Constexpr Ð´Ð»Ñ std::string | 201907L | <string> | (C++20) |
__cpp_lib_constexpr_string_view | РазнÑе constexpr биÑÑ (std::string_view::copy) | 201811L | <string_view> | (C++20) |
__cpp_lib_constexpr_tuple | РазнÑе constexpr биÑÑ (std::tuple::operator= и дÑÑгие) | 201811L | <tuple> | (C++20) |
__cpp_lib_constexpr_typeinfo | Constexpr Ð´Ð»Ñ std::type_info::operator== | 202106L | <typeinfo> | (C++23) |
__cpp_lib_constexpr_utility | РазнÑе constexpr биÑÑ (std::pair::operator= и дÑÑгие) | 201811L | <utility> | (C++20) |
__cpp_lib_constexpr_vector | Constexpr Ð´Ð»Ñ std::vector | 201907L | <vector> | (C++20) |
__cpp_lib_coroutine | СопÑогÑÐ°Ð¼Ð¼Ñ (поддеÑжка библиоÑекой) | 201902L | <coroutine> | (C++20) |
__cpp_lib_destroying_delete | УниÑÑожение operator delete (поддеÑжка библиоÑекой) |
201806L | <new> | (C++20) |
__cpp_lib_enable_shared_from_this | Ðолее ÑоÑÐ½Ð°Ñ ÑпеÑиÑикаÑÐ¸Ñ std::enable_shared_from_this | 201603L | <memory> | (C++17) |
__cpp_lib_endian | std::endian | 201907L | <bit> | (C++20) |
__cpp_lib_erase_if | РавномеÑÐ½Ð°Ñ Ð¾ÑиÑÑка конÑейнеÑа | 202002L | <string> <deque> <forward_list> <list> <vector> <map> <set> <unordered_map> <unordered_set> | (C++20) |
__cpp_lib_exchange_function | std::exchange | 201304L | <utility> | (C++14) |
__cpp_lib_execution | ÐолиÑики иÑÐ¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ | 201603L | <execution> | (C++17) |
std::execution::unsequenced_policy | 201902L | <execution> | (C++20) | |
__cpp_lib_filesystem | ÐиблиоÑека Ñайловой ÑиÑÑÐµÐ¼Ñ | 201703L | <filesystem> | (C++17) |
__cpp_lib_format | ФоÑмаÑиÑование ÑекÑÑа | 201907L | <format> | (C++20) |
__cpp_lib_gcd_lcm | std::gcd, std::lcm | 201606L | <numeric> | (C++17) |
__cpp_lib_generic_associative_lookup | ÐоиÑк геÑеÑогеннÑм ÑÑавнением в [[cpp/container#ÐÑÑоÑиаÑивнÑе конÑейнеÑÑ|аÑÑоÑиаÑивнÑÑ ÐºÐ¾Ð½ÑейнеÑÐ°Ñ | 201304L | <map> <set> | (C++14) |
__cpp_lib_generic_unordered_lookup | ÐоиÑк геÑеÑогеннÑм ÑÑавнением в аÑÑоÑиаÑивнÑÑ ÐºÐ¾Ð½ÑейнеÑÐ°Ñ | 201811L | <unordered_map> <unordered_set> | (C++20) |
__cpp_lib_hardware_interference_size | [[constexpr std::hardware_{constructive, destructive}_interference_size|hardware_destructive_interference_size|constexpr std::hardware_{constructive, destructive}_interference_size]]]] | 201703L | <new> | (C++17) |
__cpp_lib_has_unique_object_representations | std::has_unique_object_representations | 201606L | <type_traits> | (C++17) |
__cpp_lib_hypot | 3-аÑгÑменÑÐ½Ð°Ñ Ð¿ÐµÑегÑÑзка std::hypot | 201603L | <cmath> | (C++17) |
__cpp_lib_incomplete_container_elements | ÐинималÑÐ½Ð°Ñ Ð¿Ð¾Ð´Ð´ÐµÑжка неполнÑÑ Ñипов Ð´Ð»Ñ ÑÑандаÑÑнÑÑ ÐºÐ¾Ð½ÑейнеÑов | 201505L | <forward_list> <list> <vector> | (C++17) |
__cpp_lib_int_pow2 | ÐнÑегÑалÑнÑе опеÑаÑии ÑÑепени двойки (std::has_single_bit, std::bit_ceil, std::bit_floor, std::bit_length) | 202002L | <bit> | (C++20) |
__cpp_lib_integer_comparison_functions | ЦелоÑиÑленнÑе ÑÑнкÑии ÑÑÐ°Ð²Ð½ÐµÐ½Ð¸Ñ | 202002L | <utility> | (C++20) |
__cpp_lib_integer_sequence | ЦелоÑиÑленнÑе поÑледоваÑелÑноÑÑи вÑемени компилÑÑии | 201304L | <utility> | (C++14) |
__cpp_lib_integral_constant_callable | std::integral_constant::operator() | 201304L | <type_traits> | (C++14) |
__cpp_lib_interpolate | std::lerp, std::midpoint | 201902L | <cmath> <numeric> | (C++20) |
__cpp_lib_invoke | std::invoke | 201411L | <functional> | (C++17) |
__cpp_lib_invoke_r | std::invoke_r | 202106L | <functional> | (C++23) |
__cpp_lib_is_aggregate | std::is_aggregate | 201703L | <type_traits> | (C++17) |
__cpp_lib_is_constant_evaluated | std::is_constant_evaluated | 201811L | <type_traits> | (C++20) |
__cpp_lib_is_final | std::is_final | 201402L | <type_traits> | (C++14) |
__cpp_lib_is_invocable | std::is_invocable, std::invoke_result | 201703L | <type_traits> | (C++17) |
__cpp_lib_is_layout_compatible | std::is_layout_compatible | 201907L | <type_traits> | (C++20) |
__cpp_lib_is_nothrow_convertible | std::is_nothrow_convertible | 201806L | <type_traits> | (C++20) |
__cpp_lib_is_null_pointer | std::is_null_pointer | 201309L | <type_traits> | (C++14) |
__cpp_lib_is_pointer_interconvertible | СвойÑÑва ÑказаÑелÑ-взаимоконвеÑÑиÑÑемоÑÑи | 201907L | <type_traits> | (C++20) |
__cpp_lib_is_scoped_enum | std::is_scoped_enum | 202011L | <type_traits> | (C++23) |
__cpp_lib_is_swappable | [nothrow -]замена ÑвойÑÑв |
201603L | <type_traits> | (C++17) |
__cpp_lib_jthread | СÑоповÑй Ñокен и пÑиÑоединÑÑÑаÑÑÑ Ð²ÐµÑÐ²Ñ | 201911L | <stop_token> <thread> | (C++20) |
__cpp_lib_latch | std::latch | 201907L | <latch> | (C++20) |
__cpp_lib_launder | ÐÑновной ÐÑпÑÑк 1776: Ðбмен обÑекÑов клаÑÑа, ÑодеÑжаÑÐ¸Ñ ÑÑÑлоÑнÑе ÑлеменÑÑ (std::launder) | 201606L | <new> | (C++17) |
__cpp_lib_list_remove_return_type | Ðзменение Ñипа возвÑаÑа remove(), remove_if() и unique() ÑлеменÑов обÑекÑов std::forward_list и std::list | 201806L | <forward_list> <list> | (C++20) |
__cpp_lib_logical_traits | СвойÑÑва Ñипа логиÑеÑкого опеÑаÑоÑа | 201510L | <type_traits> | (C++17) |
__cpp_lib_make_from_tuple | std::make_from_tuple() | 201606L | <tuple> | (C++17) |
__cpp_lib_make_reverse_iterator | std::make_reverse_iterator | 201402L | <iterator> | (C++14) |
__cpp_lib_make_unique | std::make_unique | 201304L | <memory> | (C++14) |
__cpp_lib_map_try_emplace | std::map::try_emplace, std::map::insert_or_assign | 201411L | <map> | (C++17) |
__cpp_lib_math_constants | ÐаÑемаÑиÑеÑкие конÑÑанÑÑ | 201907L | <numbers> | (C++20) |
__cpp_lib_math_special_functions | СпеÑиалÑнÑе маÑемаÑиÑеÑкие ÑÑнкÑии Ð´Ð»Ñ C++17 | 201603L | <cmath> | (C++17) |
__cpp_lib_memory_resource | std::pmr::memory_resource | 201603L | <memory_resource> | (C++17) |
__cpp_lib_node_extract | ÐбÑединение каÑÑ Ð¸ набоÑов (std::map::extract, std::map::merge, std::map::insert(node_type) и Ñ.д.) | 201606L | <map> <set> <unordered_map> <unordered_set> | (C++17) |
__cpp_lib_nonmember_container_access | std::size(), std::data() и std::empty() | 201411L | <iterator> <array> <deque> <forward_list> <list> <map> <regex> <set> <string> <unordered_map> <unordered_set> <vector> | (C++17) |
__cpp_lib_not_fn | std::not_fn() | 201603L | <functional> | (C++17) |
__cpp_lib_null_iterators | Null LegacyForwardIterators | 201304L | <iterator> | (C++14) |
__cpp_lib_optional | std::optional | 201606L | <optional> | (C++17) |
__cpp_lib_parallel_algorithm | ÐаÑаллелÑнÑе алгоÑиÑÐ¼Ñ | 201603L | <algorithm> <numeric> | (C++17) |
__cpp_lib_polymorphic_allocator | std::polymorphic_allocator<> как Ñип ÑловаÑÑ | 201902L | <memory_resource> | (C++20) |
__cpp_lib_quoted_string_io | std::quoted | 201304L | <iomanip> | (C++14) |
__cpp_lib_ranges | ÐиблиоÑека диапазонов и огÑаниÑеннÑе алгоÑиÑÐ¼Ñ | 201911L | <algorithm> <functional> <iterator> <memory> <ranges> | (C++20) |
__cpp_lib_raw_memory_algorithms | РаÑÑиÑение инÑÑÑÑменÑов ÑпÑÐ°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ð°Ð¼ÑÑÑÑ | 201606L | <memory> | (C++17) |
__cpp_lib_remove_cvref | std::remove_cvref | 201711L | <type_traits> | (C++20) |
__cpp_lib_result_of_sfinae | std::result_of и SFINAE | 201210L | <type_traits> <functional> | (C++14) |
__cpp_lib_robust_nonmodifying_seq_ops | ÐовÑÑение ÑÑÑойÑивоÑÑи поÑледоваÑелÑноÑÑи немодиÑиÑиÑÑÑÑÐ¸Ñ Ð¾Ð¿ÐµÑаÑий (двÑÑ Ð´Ð¸Ð°Ð¿Ð°Ð·Ð¾Ð½Ð½Ñе пеÑегÑÑзки Ð´Ð»Ñ std::mismatch, std::equal и std::is_permutation) | 201304L | <algorithm> | (C++14) |
__cpp_lib_sample | std::sample | 201603L | <algorithm> | (C++17) |
__cpp_lib_scoped_lock | std::scoped_lock | 201703L | <mutex> | (C++17) |
__cpp_lib_semaphore | std::counting_semaphore , std::binary_semaphore |
201907L | <semaphore> | (C++20) |
__cpp_lib_shared_mutex | std::shared_mutex (безвÑеменной) | 201505L | <shared_mutex> | (C++17) |
__cpp_lib_shared_ptr_arrays | std::shared_ptr<T[]> | 201611L | <memory> | (C++17) |
ÐоддеÑжка маÑÑива std::make_shared | 201707L | <memory> | (C++20) | |
__cpp_lib_shared_ptr_weak_type | shared_ptr::weak_type | 201606L | <memory> | (C++17) |
__cpp_lib_shared_timed_mutex | std::shared_timed_mutex | 201402L | <shared_mutex> | (C++14) |
__cpp_lib_shift | std::shift_left и std::shift_right | 201806L | <algorithm> | (C++20) |
__cpp_lib_smart_ptr_for_overwrite | Создание Ñмного ÑказаÑÐµÐ»Ñ Ñ Ð¸Ð½Ð¸ÑиализаÑией по ÑмолÑÐ°Ð½Ð¸Ñ (std::allocate_shared_for_overwrite, std::make_shared_for_overwrite, std::make_unique_for_overwrite) | 202002L | <memory> | (C++20) |
__cpp_lib_source_location | Ð¡Ð±Ð¾Ñ Ð¸Ð½ÑоÑмаÑии об иÑÑ Ð¾Ð´Ð½Ð¾Ð¼ коде (std::source_location) | 201907L | <source_location> | (C++20) |
__cpp_lib_span | std::span | 202002L | <span> | (C++20) |
__cpp_lib_ssize | std::ssize и беззнаковÑй std::span::size | 201902L | <iterator> | (C++20) |
__cpp_lib_stacktrace | ÐиблиоÑека Stacktrace | 202011L | <stacktrace> | (C++23) |
__cpp_lib_starts_ends_with | ÐÑовеÑка пÑеÑикÑа и ÑÑÑÑикÑа ÑÑÑоки (starts_with() и ends_with() Ð´Ð»Ñ std::string и std::string_view) | 201711L | <string> <string_view> | (C++20) |
__cpp_lib_stdatomic_h | Ðаголовок ÑовмеÑÑимоÑÑи Ð´Ð»Ñ Ð°ÑомаÑнÑÑ Ð¾Ð¿ÐµÑаÑий C | 202011L | <stdatomic.h> | (C++23) |
__cpp_lib_string_contains | ФÑнкÑии contains обÑекÑов std::basic_string и std::basic_string_view |
202011L | <string> <string_view> | (C++23) |
__cpp_lib_string_udls | ÐолÑзоваÑелÑÑкие лиÑеÑÐ°Ð»Ñ Ð´Ð»Ñ ÑÑÑоковÑÑ Ñипов | 201304L | <string> | (C++14) |
__cpp_lib_string_view | std::string_view | 201606L | <string> <string_view> | (C++17) |
ConstexprIterator | 201803L | <string> <string_view> | (C++20) | |
__cpp_lib_syncbuf | Ð¡Ð¸Ð½Ñ ÑонизиÑованнÑй бÑÑеÑизиÑованнÑй ostream (std::syncbuf, std::osyncstream) и манипÑлÑÑоÑÑ | 201803L | <syncstream> | (C++20) |
__cpp_lib_three_way_comparison | ТÑÑÑ ÑÑоÑоннее ÑÑавнение (поддеÑжка библиоÑекой); добавление ÑÑÑÑ ÑÑоÑоннего ÑÑÐ°Ð²Ð½ÐµÐ½Ð¸Ñ Ð² библиоÑÐµÐºÑ | 201907L | <compare> | (C++20) |
__cpp_lib_to_address | УÑилиÑа Ð´Ð»Ñ Ð¿ÑеобÑÐ°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ ÑказаÑÐµÐ»Ñ Ð² ÑÑÑой ÑказаÑÐµÐ»Ñ (std::to_address) | 201711L | <memory> | (C++20) |
__cpp_lib_to_array | std::to_array | 201907L | <array> | (C++20) |
__cpp_lib_to_chars | ÐлеменÑаÑнÑе пÑеобÑÐ°Ð·Ð¾Ð²Ð°Ð½Ð¸Ñ ÑÑÑок (std::to_chars, std::from_chars) | 201611L | <charconv> | (C++17) |
__cpp_lib_to_underlying | std::to_underlying | 2XXXXXL | <utility> | (C++23) |
__cpp_lib_transformation_trait_aliases | Ð¨Ð°Ð±Ð»Ð¾Ð½Ñ Ð¿Ñевдонимов Ð´Ð»Ñ TransformationTraits | 201304L | <type_traits> | (C++14) |
__cpp_lib_transparent_operators | ÐÑозÑаÑнÑе опеÑаÑоÑÑ ÑÑнкÑоÑÑ (std::less<> и дÑÑгие) | 201210L | <functional> | (C++14) |
ÐÑозÑаÑнÑй std::owner_less (std::owner_less<void>) | 201510L | <memory> <functional> | (C++17) | |
__cpp_lib_tuple_element_t | std::tuple_element_t | 201402L | <tuple> | (C++14) |
__cpp_lib_tuples_by_type | ÐдÑеÑаÑÐ¸Ñ ÐºÐ¾ÑÑежей по ÑÐ¸Ð¿Ñ | 201304L | <tuple> <utility> | (C++14) |
__cpp_lib_type_identity | std::type_identity | 201806L | <type_traits> | (C++20) |
__cpp_lib_type_trait_variable_templates | Ð¨Ð°Ð±Ð»Ð¾Ð½Ñ Ð¿ÐµÑеменнÑÑ ÑвойÑÑв Ñипов (std::is_void_v, etc) | 201510L | <type_traits> | (C++17) |
__cpp_lib_uncaught_exceptions | std::uncaught_exceptions | 201411L | <exception> | (C++17) |
__cpp_lib_unordered_map_try_emplace | std::unordered_map::try_emplace, std::unordered_map::insert_or_assign | 201411L | <unordered_map> | (C++17) |
__cpp_lib_unwrap_ref | std::unwrap_ref_decay и std::unwrap_reference | 201811L | <functional> | (C++20) |
__cpp_lib_variant | std::variant: ÑипобезопаÑное обÑединение Ð´Ð»Ñ C++17 | 201606L | <variant> | (C++17) |
__cpp_lib_void_t | std::void_t | 201411L | <type_traits> | (C++17) |
[пÑавиÑÑ] ÐÑимеÑ
#ifdef __has_include // ÐÑовеÑÑÐµÑ ÑÑÑеÑÑвÑÐµÑ Ð»Ð¸ __has_include # if __has_include(<optional>) // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие ÑÑандаÑÑной # include <optional> // библиоÑеки # elif __has_include(<experimental/optional>) // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие ÑкÑпеÑименÑалÑной # include <experimental/optional> // веÑÑии # elif __has_include(<boost/optional.hpp>) // ÐÑобÑÐµÑ Ñ Ð²Ð½ÐµÑней библиоÑекой # include <boost/optional.hpp> # else // ÐиÑего не найдено # error "ÐÑÑÑÑÑÑвÑÐµÑ <optional>" # endif #endif #ifdef __has_cpp_attribute // ÐÑовеÑÑÐµÑ ÑÑÑеÑÑвÑÐµÑ Ð»Ð¸ // __has_cpp_attribute # if __has_cpp_attribute(deprecated) // ÐÑовеÑÑÐµÑ Ð°ÑÑибÑÑ # define DEPRECATED(msg) [[deprecated(msg)]] # endif #endif #ifndef DEPRECATED # define DEPRECATED(msg) #endif DEPRECATED("foo() ÑÑÑаÑела") void foo(); #if __cpp_constexpr >= 201304 // ÐÑовеÑÑÐµÑ ÐºÐ¾Ð½ÐºÑеÑнÑÑ Ð²ÐµÑÑÐ¸Ñ ÑÑнкÑионалÑноÑÑи # define CONSTEXPR constexpr #else # define CONSTEXPR inline #endif CONSTEXPR int bar(unsigned i) { #if __cpp_binary_literals // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие ÑÑнкÑионалÑноÑÑи unsigned mask1 = 0b11000000; unsigned mask2 = 0b00000111; #else unsigned mask1 = 0xC0; unsigned mask2 = 0x07; #endif if ( i & mask1 ) return 1; if ( i & mask2 ) return 2; return 0; } int main() { }
[пÑавиÑÑ] ÐÑимеÑ
СледÑÑÑÐ°Ñ Ð¿ÑогÑамма вÑÐ²Ð¾Ð´Ð¸Ñ Ð´Ð°Ð½Ð½Ñе о ÑÑнкÑиÑÑ Ð¸ аÑÑибÑÑÐ°Ñ ÐºÐ¾Ð¼Ð¿Ð¸Ð»ÑÑоÑа C++.
#if __cplusplus < 201100 # оÑибка "ТÑебÑеÑÑÑ C++11 или лÑÑÑе" #endif #include <algorithm> #include <cstring> #include <iomanip> #include <iostream> #include <string> #ifdef __has_include # if __has_include(<version>) # include <version> # endif #endif #define COMPILER_FEATURE_VALUE(value) #value #define COMPILER_FEATURE_ENTRY(name) { #name, COMPILER_FEATURE_VALUE(name) }, #ifdef __has_cpp_attribute # define COMPILER_ATTRIBUTE_VALUE_AS_STRING(s) #s # define COMPILER_ATTRIBUTE_AS_NUMBER(x) COMPILER_ATTRIBUTE_VALUE_AS_STRING(x) # define COMPILER_ATTRIBUTE_ENTRY(attr) \ { #attr, COMPILER_ATTRIBUTE_AS_NUMBER(__has_cpp_attribute(attr)) }, #else # define COMPILER_ATTRIBUTE_ENTRY(attr) { #attr, "_" }, #endif // ÐзмениÑе ÑÑи паÑамеÑÑÑ, ÑÑÐ¾Ð±Ñ Ð²ÑвеÑÑи ÑолÑко Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼ÑÑ Ð¸Ð½ÑоÑмаÑиÑ. static struct PrintOptions { constexpr static bool titles = 1; constexpr static bool attributes = 1; constexpr static bool general_features = 1; constexpr static bool core_features = 1; constexpr static bool lib_features = 1; constexpr static bool supported_features = 1; constexpr static bool unsupported_features = 1; constexpr static bool sorted_by_value = 0; constexpr static bool cxx11 = 1; constexpr static bool cxx14 = 1; constexpr static bool cxx17 = 1; constexpr static bool cxx20 = 1; constexpr static bool cxx23 = 1; } print; struct CompilerFeature { CompilerFeature(const char* name = nullptr, const char* value = nullptr) : name(name), value(value) {} const char* name; const char* value; }; static CompilerFeature cxx[] = { COMPILER_FEATURE_ENTRY(__cplusplus) COMPILER_FEATURE_ENTRY(__cpp_exceptions) COMPILER_FEATURE_ENTRY(__cpp_rtti) #if 0 COMPILER_FEATURE_ENTRY(__GNUC__) COMPILER_FEATURE_ENTRY(__GNUC_MINOR__) COMPILER_FEATURE_ENTRY(__GNUC_PATCHLEVEL__) COMPILER_FEATURE_ENTRY(__GNUG__) COMPILER_FEATURE_ENTRY(__clang__) COMPILER_FEATURE_ENTRY(__clang_major__) COMPILER_FEATURE_ENTRY(__clang_minor__) COMPILER_FEATURE_ENTRY(__clang_patchlevel__) #endif }; static CompilerFeature cxx11[] = { COMPILER_FEATURE_ENTRY(__cpp_alias_templates) COMPILER_FEATURE_ENTRY(__cpp_attributes) COMPILER_FEATURE_ENTRY(__cpp_constexpr) COMPILER_FEATURE_ENTRY(__cpp_decltype) COMPILER_FEATURE_ENTRY(__cpp_delegating_constructors) COMPILER_FEATURE_ENTRY(__cpp_inheriting_constructors) COMPILER_FEATURE_ENTRY(__cpp_initializer_lists) COMPILER_FEATURE_ENTRY(__cpp_lambdas) COMPILER_FEATURE_ENTRY(__cpp_nsdmi) COMPILER_FEATURE_ENTRY(__cpp_range_based_for) COMPILER_FEATURE_ENTRY(__cpp_raw_strings) COMPILER_FEATURE_ENTRY(__cpp_ref_qualifiers) COMPILER_FEATURE_ENTRY(__cpp_rvalue_references) COMPILER_FEATURE_ENTRY(__cpp_static_assert) COMPILER_FEATURE_ENTRY(__cpp_threadsafe_static_init) COMPILER_FEATURE_ENTRY(__cpp_unicode_characters) COMPILER_FEATURE_ENTRY(__cpp_unicode_literals) COMPILER_FEATURE_ENTRY(__cpp_user_defined_literals) COMPILER_FEATURE_ENTRY(__cpp_variadic_templates) }; static CompilerFeature cxx14[] = { COMPILER_FEATURE_ENTRY(__cpp_aggregate_nsdmi) COMPILER_FEATURE_ENTRY(__cpp_binary_literals) COMPILER_FEATURE_ENTRY(__cpp_constexpr) COMPILER_FEATURE_ENTRY(__cpp_decltype_auto) COMPILER_FEATURE_ENTRY(__cpp_generic_lambdas) COMPILER_FEATURE_ENTRY(__cpp_init_captures) COMPILER_FEATURE_ENTRY(__cpp_return_type_deduction) COMPILER_FEATURE_ENTRY(__cpp_sized_deallocation) COMPILER_FEATURE_ENTRY(__cpp_variable_templates) }; static CompilerFeature cxx14lib[] = { COMPILER_FEATURE_ENTRY(__cpp_lib_chrono_udls) COMPILER_FEATURE_ENTRY(__cpp_lib_complex_udls) COMPILER_FEATURE_ENTRY(__cpp_lib_exchange_function) COMPILER_FEATURE_ENTRY(__cpp_lib_generic_associative_lookup) COMPILER_FEATURE_ENTRY(__cpp_lib_integer_sequence) COMPILER_FEATURE_ENTRY(__cpp_lib_integral_constant_callable) COMPILER_FEATURE_ENTRY(__cpp_lib_is_final) COMPILER_FEATURE_ENTRY(__cpp_lib_is_null_pointer) COMPILER_FEATURE_ENTRY(__cpp_lib_make_reverse_iterator) COMPILER_FEATURE_ENTRY(__cpp_lib_make_unique) COMPILER_FEATURE_ENTRY(__cpp_lib_null_iterators) COMPILER_FEATURE_ENTRY(__cpp_lib_quoted_string_io) COMPILER_FEATURE_ENTRY(__cpp_lib_result_of_sfinae) COMPILER_FEATURE_ENTRY(__cpp_lib_robust_nonmodifying_seq_ops) COMPILER_FEATURE_ENTRY(__cpp_lib_shared_timed_mutex) COMPILER_FEATURE_ENTRY(__cpp_lib_string_udls) COMPILER_FEATURE_ENTRY(__cpp_lib_transformation_trait_aliases) COMPILER_FEATURE_ENTRY(__cpp_lib_transparent_operators) COMPILER_FEATURE_ENTRY(__cpp_lib_tuple_element_t) COMPILER_FEATURE_ENTRY(__cpp_lib_tuples_by_type) }; static CompilerFeature cxx17[] = { COMPILER_FEATURE_ENTRY(__cpp_aggregate_bases) COMPILER_FEATURE_ENTRY(__cpp_aligned_new) COMPILER_FEATURE_ENTRY(__cpp_capture_star_this) COMPILER_FEATURE_ENTRY(__cpp_constexpr) COMPILER_FEATURE_ENTRY(__cpp_deduction_guides) COMPILER_FEATURE_ENTRY(__cpp_enumerator_attributes) COMPILER_FEATURE_ENTRY(__cpp_fold_expressions) COMPILER_FEATURE_ENTRY(__cpp_guaranteed_copy_elision) COMPILER_FEATURE_ENTRY(__cpp_hex_float) COMPILER_FEATURE_ENTRY(__cpp_if_constexpr) COMPILER_FEATURE_ENTRY(__cpp_inheriting_constructors) COMPILER_FEATURE_ENTRY(__cpp_inline_variables) COMPILER_FEATURE_ENTRY(__cpp_namespace_attributes) COMPILER_FEATURE_ENTRY(__cpp_noexcept_function_type) COMPILER_FEATURE_ENTRY(__cpp_nontype_template_args) COMPILER_FEATURE_ENTRY(__cpp_nontype_template_parameter_auto) COMPILER_FEATURE_ENTRY(__cpp_range_based_for) COMPILER_FEATURE_ENTRY(__cpp_static_assert) COMPILER_FEATURE_ENTRY(__cpp_structured_bindings) COMPILER_FEATURE_ENTRY(__cpp_template_template_args) COMPILER_FEATURE_ENTRY(__cpp_variadic_using) }; static CompilerFeature cxx17lib[] = { COMPILER_FEATURE_ENTRY(__cpp_lib_addressof_constexpr) COMPILER_FEATURE_ENTRY(__cpp_lib_allocator_traits_is_always_equal) COMPILER_FEATURE_ENTRY(__cpp_lib_any) COMPILER_FEATURE_ENTRY(__cpp_lib_apply) COMPILER_FEATURE_ENTRY(__cpp_lib_array_constexpr) COMPILER_FEATURE_ENTRY(__cpp_lib_as_const) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_is_always_lock_free) COMPILER_FEATURE_ENTRY(__cpp_lib_bool_constant) COMPILER_FEATURE_ENTRY(__cpp_lib_boyer_moore_searcher) COMPILER_FEATURE_ENTRY(__cpp_lib_byte) COMPILER_FEATURE_ENTRY(__cpp_lib_chrono) COMPILER_FEATURE_ENTRY(__cpp_lib_clamp) COMPILER_FEATURE_ENTRY(__cpp_lib_enable_shared_from_this) COMPILER_FEATURE_ENTRY(__cpp_lib_execution) COMPILER_FEATURE_ENTRY(__cpp_lib_filesystem) COMPILER_FEATURE_ENTRY(__cpp_lib_gcd_lcm) COMPILER_FEATURE_ENTRY(__cpp_lib_hardware_interference_size) COMPILER_FEATURE_ENTRY(__cpp_lib_has_unique_object_representations) COMPILER_FEATURE_ENTRY(__cpp_lib_hypot) COMPILER_FEATURE_ENTRY(__cpp_lib_incomplete_container_elements) COMPILER_FEATURE_ENTRY(__cpp_lib_invoke) COMPILER_FEATURE_ENTRY(__cpp_lib_is_aggregate) COMPILER_FEATURE_ENTRY(__cpp_lib_is_invocable) COMPILER_FEATURE_ENTRY(__cpp_lib_is_swappable) COMPILER_FEATURE_ENTRY(__cpp_lib_launder) COMPILER_FEATURE_ENTRY(__cpp_lib_logical_traits) COMPILER_FEATURE_ENTRY(__cpp_lib_make_from_tuple) COMPILER_FEATURE_ENTRY(__cpp_lib_map_try_emplace) COMPILER_FEATURE_ENTRY(__cpp_lib_math_special_functions) COMPILER_FEATURE_ENTRY(__cpp_lib_memory_resource) COMPILER_FEATURE_ENTRY(__cpp_lib_node_extract) COMPILER_FEATURE_ENTRY(__cpp_lib_nonmember_container_access) COMPILER_FEATURE_ENTRY(__cpp_lib_not_fn) COMPILER_FEATURE_ENTRY(__cpp_lib_optional) COMPILER_FEATURE_ENTRY(__cpp_lib_parallel_algorithm) COMPILER_FEATURE_ENTRY(__cpp_lib_raw_memory_algorithms) COMPILER_FEATURE_ENTRY(__cpp_lib_sample) COMPILER_FEATURE_ENTRY(__cpp_lib_scoped_lock) COMPILER_FEATURE_ENTRY(__cpp_lib_shared_mutex) COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_arrays) COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_weak_type) COMPILER_FEATURE_ENTRY(__cpp_lib_string_view) COMPILER_FEATURE_ENTRY(__cpp_lib_to_chars) COMPILER_FEATURE_ENTRY(__cpp_lib_transparent_operators) COMPILER_FEATURE_ENTRY(__cpp_lib_type_trait_variable_templates) COMPILER_FEATURE_ENTRY(__cpp_lib_uncaught_exceptions) COMPILER_FEATURE_ENTRY(__cpp_lib_unordered_map_try_emplace) COMPILER_FEATURE_ENTRY(__cpp_lib_variant) COMPILER_FEATURE_ENTRY(__cpp_lib_void_t) }; static CompilerFeature cxx20[] = { COMPILER_FEATURE_ENTRY(__cpp_aggregate_paren_init) COMPILER_FEATURE_ENTRY(__cpp_char8_t) COMPILER_FEATURE_ENTRY(__cpp_concepts) COMPILER_FEATURE_ENTRY(__cpp_conditional_explicit) COMPILER_FEATURE_ENTRY(__cpp_consteval) COMPILER_FEATURE_ENTRY(__cpp_constexpr) COMPILER_FEATURE_ENTRY(__cpp_constexpr_dynamic_alloc) COMPILER_FEATURE_ENTRY(__cpp_constexpr_in_decltype) COMPILER_FEATURE_ENTRY(__cpp_constinit) COMPILER_FEATURE_ENTRY(__cpp_deduction_guides) COMPILER_FEATURE_ENTRY(__cpp_designated_initializers) COMPILER_FEATURE_ENTRY(__cpp_generic_lambdas) COMPILER_FEATURE_ENTRY(__cpp_impl_coroutine) COMPILER_FEATURE_ENTRY(__cpp_impl_destroying_delete) COMPILER_FEATURE_ENTRY(__cpp_impl_three_way_comparison) COMPILER_FEATURE_ENTRY(__cpp_init_captures) COMPILER_FEATURE_ENTRY(__cpp_modules) COMPILER_FEATURE_ENTRY(__cpp_nontype_template_args) COMPILER_FEATURE_ENTRY(__cpp_using_enum) }; static CompilerFeature cxx20lib[] = { COMPILER_FEATURE_ENTRY(__cpp_lib_array_constexpr) COMPILER_FEATURE_ENTRY(__cpp_lib_assume_aligned) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_flag_test) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_float) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_lock_free_type_aliases) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_ref) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_shared_ptr) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_value_initialization) COMPILER_FEATURE_ENTRY(__cpp_lib_atomic_wait) COMPILER_FEATURE_ENTRY(__cpp_lib_barrier) COMPILER_FEATURE_ENTRY(__cpp_lib_bind_front) COMPILER_FEATURE_ENTRY(__cpp_lib_bit_cast) COMPILER_FEATURE_ENTRY(__cpp_lib_bitops) COMPILER_FEATURE_ENTRY(__cpp_lib_bounded_array_traits) COMPILER_FEATURE_ENTRY(__cpp_lib_char8_t) COMPILER_FEATURE_ENTRY(__cpp_lib_chrono) COMPILER_FEATURE_ENTRY(__cpp_lib_concepts) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_algorithms) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_complex) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_dynamic_alloc) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_functional) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_iterator) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_memory) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_numeric) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_string) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_string_view) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_tuple) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_utility) COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_vector) COMPILER_FEATURE_ENTRY(__cpp_lib_coroutine) COMPILER_FEATURE_ENTRY(__cpp_lib_destroying_delete) COMPILER_FEATURE_ENTRY(__cpp_lib_endian) COMPILER_FEATURE_ENTRY(__cpp_lib_erase_if) COMPILER_FEATURE_ENTRY(__cpp_lib_execution) COMPILER_FEATURE_ENTRY(__cpp_lib_format) COMPILER_FEATURE_ENTRY(__cpp_lib_generic_unordered_lookup) COMPILER_FEATURE_ENTRY(__cpp_lib_int_pow2) COMPILER_FEATURE_ENTRY(__cpp_lib_integer_comparison_functions) COMPILER_FEATURE_ENTRY(__cpp_lib_interpolate) COMPILER_FEATURE_ENTRY(__cpp_lib_is_constant_evaluated) COMPILER_FEATURE_ENTRY(__cpp_lib_is_layout_compatible) COMPILER_FEATURE_ENTRY(__cpp_lib_is_nothrow_convertible) COMPILER_FEATURE_ENTRY(__cpp_lib_is_pointer_interconvertible) COMPILER_FEATURE_ENTRY(__cpp_lib_jthread) COMPILER_FEATURE_ENTRY(__cpp_lib_latch) COMPILER_FEATURE_ENTRY(__cpp_lib_list_remove_return_type) COMPILER_FEATURE_ENTRY(__cpp_lib_math_constants) COMPILER_FEATURE_ENTRY(__cpp_lib_polymorphic_allocator) COMPILER_FEATURE_ENTRY(__cpp_lib_ranges) COMPILER_FEATURE_ENTRY(__cpp_lib_remove_cvref) COMPILER_FEATURE_ENTRY(__cpp_lib_semaphore) COMPILER_FEATURE_ENTRY(__cpp_lib_shared_ptr_arrays) COMPILER_FEATURE_ENTRY(__cpp_lib_shift) COMPILER_FEATURE_ENTRY(__cpp_lib_smart_ptr_for_overwrite) COMPILER_FEATURE_ENTRY(__cpp_lib_source_location) COMPILER_FEATURE_ENTRY(__cpp_lib_span) COMPILER_FEATURE_ENTRY(__cpp_lib_ssize) COMPILER_FEATURE_ENTRY(__cpp_lib_starts_ends_with) COMPILER_FEATURE_ENTRY(__cpp_lib_string_view) COMPILER_FEATURE_ENTRY(__cpp_lib_syncbuf) COMPILER_FEATURE_ENTRY(__cpp_lib_three_way_comparison) COMPILER_FEATURE_ENTRY(__cpp_lib_to_address) COMPILER_FEATURE_ENTRY(__cpp_lib_to_array) COMPILER_FEATURE_ENTRY(__cpp_lib_type_identity) COMPILER_FEATURE_ENTRY(__cpp_lib_unwrap_ref) }; static CompilerFeature cxx23[] = { // ÐÑодолжиÑÑ ÐаполнÑÑÑ COMPILER_FEATURE_ENTRY(__cpp_if_consteval) COMPILER_FEATURE_ENTRY(__cpp_size_t_suffix) }; // ÐÑодолжиÑÑ ÐаполнÑÑÑ static CompilerFeature cxx23lib[] = { COMPILER_FEATURE_ENTRY(__cpp_lib_constexpr_typeinfo) COMPILER_FEATURE_ENTRY(__cpp_lib_invoke_r) COMPILER_FEATURE_ENTRY(__cpp_lib_is_scoped_enum) COMPILER_FEATURE_ENTRY(__cpp_lib_stacktrace) COMPILER_FEATURE_ENTRY(__cpp_lib_stdatomic_h) COMPILER_FEATURE_ENTRY(__cpp_lib_string_contains) }; static CompilerFeature attributes[] = { COMPILER_ATTRIBUTE_ENTRY(carries_dependency) COMPILER_ATTRIBUTE_ENTRY(deprecated) COMPILER_ATTRIBUTE_ENTRY(fallthrough) COMPILER_ATTRIBUTE_ENTRY(likely) COMPILER_ATTRIBUTE_ENTRY(maybe_unused) COMPILER_ATTRIBUTE_ENTRY(nodiscard) COMPILER_ATTRIBUTE_ENTRY(noreturn) COMPILER_ATTRIBUTE_ENTRY(no_unique_address) COMPILER_ATTRIBUTE_ENTRY(unlikely) }; constexpr bool is_feature_supported(const CompilerFeature& x) { return x.value[0] != '_' && x.value[0] != '0' ; } inline void print_compiler_feature(const CompilerFeature& x) { constexpr static int max_name_length = 44; //< ÐÑи Ð½ÐµÐ¾Ð±Ñ Ð¾Ð´Ð¸Ð¼Ð¾ÑÑи обновиÑе std::string value{ is_feature_supported(x) ? x.value : "------" }; if (value.back() == 'L') value.pop_back(); //~ 201603L -> 201603 // value.insert(4, 1, '-'); //~ 201603 -> 2016-03 if ( (print.supported_features && is_feature_supported(x)) or (print.unsupported_features && !is_feature_supported(x))) { std::cout << std::left << std::setw(max_name_length) << x.name << " " << value << '\n'; } } template<size_t N> inline void show(char const* title, CompilerFeature (&features)[N]) { if (print.titles) { std::cout << '\n' << std::left << title << '\n'; } if (print.sorted_by_value) { std::sort(std::begin(features), std::end(features), [](CompilerFeature const& lhs, CompilerFeature const& rhs) { return std::strcmp(lhs.value, rhs.value) < 0; }); } for (const CompilerFeature& x : features) { print_compiler_feature(x); } } int main() { if (print.general_features) show("C++ ÐСÐÐÐЫ", cxx); if (print.cxx11 && print.core_features) show("C++11 ЯÐÐ Ð". , cxx11); if (print.cxx14 && print.core_features) show("C++14 ЯÐÐ Ð". , cxx14); if (print.cxx14 && print.lib_features ) show("C++14 ÐÐÐÐÐÐТÐÐÐ", cxx14lib); if (print.cxx17 && print.core_features) show("C++17 ЯÐÐ Ð" , cxx17); if (print.cxx17 && print.lib_features ) show("C++17 ÐÐÐÐÐÐТÐÐÐ", cxx17lib); if (print.cxx20 && print.core_features) show("C++20 ЯÐÐ Ð" , cxx20); if (print.cxx20 && print.lib_features ) show("C++20 ÐÐÐÐÐÐТÐÐÐ", cxx20lib); if (print.cxx23 && print.core_features) show("C++23 ЯÐÐ Ð" , cxx23); if (print.cxx23 && print.lib_features ) show("C++23 ÐÐÐÐÐÐТÐÐÐ", cxx23lib); if (print.attributes) show("ÐТРÐÐУТЫ", attributes); }
ÐозможнÑй вÑвод:
C++ ÐСÐÐÐЫ __cplusplus 202002 __cpp_exceptions 199711 __cpp_rtti 199711 C++11 ЯÐÐ Ð __cpp_alias_templates 200704 __cpp_attributes 200809 __cpp_constexpr 201907 __cpp_decltype 200707 __cpp_delegating_constructors 200604 __cpp_inheriting_constructors 201511 __cpp_initializer_lists 200806 __cpp_lambdas 200907 __cpp_nsdmi 200809 __cpp_range_based_for 201603 __cpp_raw_strings 200710 __cpp_ref_qualifiers 200710 __cpp_rvalue_references 200610 __cpp_static_assert 201411 __cpp_threadsafe_static_init 200806 __cpp_unicode_characters 200704 __cpp_unicode_literals 200710 __cpp_user_defined_literals 200809 __cpp_variadic_templates 200704 C++14 ЯÐÐ Ð __cpp_aggregate_nsdmi 201304 __cpp_binary_literals 201304 __cpp_constexpr 201907 __cpp_decltype_auto 201304 __cpp_generic_lambdas 201707 __cpp_init_captures 201803 __cpp_return_type_deduction 201304 __cpp_sized_deallocation ------ __cpp_variable_templates 201304 ... ÑÑеÑено ...
[пÑавиÑÑ] ÐÑимеÑ
#ifdef __has_include // ÐÑовеÑÑеÑ, пÑиÑÑÑÑÑвÑÐµÑ Ð»Ð¸ __has_include # if __has_include(<optional>) // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие ÑÑандаÑÑной библиоÑеки # include <optional> # elif __has_include(<experimental/optional>) // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие ÑкÑпеÑименÑалÑной // веÑÑии # include <experimental/optional> # elif __has_include(<boost/optional.hpp>) // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие внеÑней библиоÑеки # include <boost/optional.hpp> # else // ÐообÑе ниÑего не найдено # error "ÐÑÑÑÑÑÑвÑÐµÑ <optional>" # endif #endif #ifdef __has_cpp_attribute // ÐÑовеÑÑеÑ, пÑиÑÑÑÑÑвÑÐµÑ Ð»Ð¸ // __has_cpp_attribute # if __has_cpp_attribute(deprecated) // ÐÑовеÑÑÐµÑ Ð°ÑÑибÑÑ # define DEPRECATED(msg) [[deprecated(msg)]] # endif #endif #ifndef DEPRECATED # define DEPRECATED(msg) #endif DEPRECATED("foo() ÑÑÑаÑела") void foo(); #if __cpp_constexpr >= 201304 // ÐÑовеÑÑÐµÑ ÐºÐ¾Ð½ÐºÑеÑнÑÑ Ð²ÐµÑÑÐ¸Ñ // ÑÑнкÑионалÑноÑÑи # define CONSTEXPR constexpr #else # define CONSTEXPR inline #endif CONSTEXPR int bar(unsigned i) { #if __cpp_binary_literals // ÐÑовеÑÑÐµÑ Ð½Ð°Ð»Ð¸Ñие ÑÑнкÑионалÑноÑÑи unsigned mask1 = 0b11000000; unsigned mask2 = 0b00000111; #else unsigned mask1 = 0xC0; unsigned mask2 = 0x07; #endif if ( i & mask1 ) return 1; if ( i & mask2 ) return 2; return 0; } int main() { }
[пÑавиÑÑ] СмоÑÑиÑе Ñакже
ÐакÑоÑÑ ÑеÑÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ ÑÑнкÑионалÑноÑÑи библиоÑеки (C++20) | опÑеделÑнннÑе в <version> |
ÐÑиÑиалÑнÑй докÑÐ¼ÐµÐ½Ñ Ñ Ð ÐµÐºÐ¾Ð¼ÐµÐ½Ð´Ð°ÑиÑми по ТеÑÑиÑÐ¾Ð²Ð°Ð½Ð¸Ñ Ð¤ÑнкÑионалÑноÑÑи | |
ÐÑÑ Ð¾Ð´Ð½Ñй код Ð´Ð»Ñ Ð´Ð°Ð¼Ð¿Ð° возможноÑÑей компилÑÑоÑа | |
ÐокÑменÑаÑÐ¸Ñ Ð¿Ð¾ C++ Ð´Ð»Ñ ÐÐ½Ð´ÐµÐºÑ ÐакÑо Символов
|