检测并打印C++编译器支持的feature(附Visual Studio 2022测试结果)

news2024/10/3 0:34:44

C++标准快速迭代,不同的系统平台和编译器对C++各种新功能的支持不同,通过这个程序可以测试所用编译器对各个版本C++的支持情况。另一方面,可以在代码中通过这些宏针对不同版本编写不同的代码分支。
源码下面附上Visual Studio 2022的测试结果,基本上在2021年中就把C++23(当时还是草案)大部分功能都支持了。

测试代码

测试代码引用网址:https://en.cppreference.com/w/cpp/feature_test

#if __cplusplus < 201100
#  error "C++11 or better is required"
#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)
        COMPILER_FEATURE_ENTRY(__cpp_lib_to_underlying)
        COMPILER_FEATURE_ENTRY(__cpp_lib_variant)
};

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; //< Update if necessary
    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<std::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++ GENERAL", cxx);
    if (print.cxx11 && print.core_features) show("C++11 CORE", cxx11);
    if (print.cxx14 && print.core_features) show("C++14 CORE", cxx14);
    if (print.cxx14 && print.lib_features ) show("C++14 LIB" , cxx14lib);
    if (print.cxx17 && print.core_features) show("C++17 CORE", cxx17);
    if (print.cxx17 && print.lib_features ) show("C++17 LIB" , cxx17lib);
    if (print.cxx20 && print.core_features) show("C++20 CORE", cxx20);
    if (print.cxx20 && print.lib_features ) show("C++20 LIB" , cxx20lib);
    if (print.cxx23 && print.core_features) show("C++23 CORE", cxx23);
    if (print.cxx23 && print.lib_features ) show("C++23 LIB" , cxx23lib);
    if (print.attributes) show("ATTRIBUTES", attributes);
}

测试结果

以下是visual studio 2022的测试结果,支持的feature比较全。

  1. 需要在项目属性中选择最新的C++版本。需要选择“预览”选项,C++23的feature才会支持。
    在这里插入图片描述
  2. vs编译器中__cplusplus对应值是199711,测试程序开头(前3行)的监测不能通过,可以注释掉或者修改第一行的数值。
    gcc或者clang都没可以直接测试通过。
C++ GENERAL
__cplusplus                                  199711
__cpp_exceptions                             199711
__cpp_rtti                                   199711

C++11 CORE
__cpp_alias_templates                        200704
__cpp_attributes                             200809
__cpp_constexpr                              202002
__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 CORE
__cpp_aggregate_nsdmi                        201304
__cpp_binary_literals                        201304
__cpp_constexpr                              202002
__cpp_decltype_auto                          201304
__cpp_generic_lambdas                        201707
__cpp_init_captures                          201803
__cpp_return_type_deduction                  201304
__cpp_sized_deallocation                     201309
__cpp_variable_templates                     201304

C++14 LIB
__cpp_lib_chrono_udls                        201304
__cpp_lib_complex_udls                       201309
__cpp_lib_exchange_function                  201304
__cpp_lib_generic_associative_lookup         201304
__cpp_lib_integer_sequence                   201304
__cpp_lib_integral_constant_callable         201304
__cpp_lib_is_final                           201402
__cpp_lib_is_null_pointer                    201309
__cpp_lib_make_reverse_iterator              201402
__cpp_lib_make_unique                        201304
__cpp_lib_null_iterators                     201304
__cpp_lib_quoted_string_io                   201304
__cpp_lib_result_of_sfinae                   201210
__cpp_lib_robust_nonmodifying_seq_ops        201304
__cpp_lib_shared_timed_mutex                 201402
__cpp_lib_string_udls                        201304
__cpp_lib_transformation_trait_aliases       201304
__cpp_lib_transparent_operators              201510
__cpp_lib_tuple_element_t                    201402
__cpp_lib_tuples_by_type                     201304

C++17 CORE
__cpp_aggregate_bases                        201603
__cpp_aligned_new                            201606
__cpp_capture_star_this                      201603
__cpp_constexpr                              202002
__cpp_deduction_guides                       201907
__cpp_enumerator_attributes                  201411
__cpp_fold_expressions                       201603
__cpp_guaranteed_copy_elision                201606
__cpp_hex_float                              201603
__cpp_if_constexpr                           201606
__cpp_inheriting_constructors                201511
__cpp_inline_variables                       201606
__cpp_namespace_attributes                   201411
__cpp_noexcept_function_type                 201510
__cpp_nontype_template_args                  201911
__cpp_nontype_template_parameter_auto        201606
__cpp_range_based_for                        201603
__cpp_static_assert                          201411
__cpp_structured_bindings                    201606
__cpp_template_template_args                 201611
__cpp_variadic_using                         201611

C++17 LIB
__cpp_lib_addressof_constexpr                201603
__cpp_lib_allocator_traits_is_always_equal   201411
__cpp_lib_any                                201606
__cpp_lib_apply                              201603
__cpp_lib_array_constexpr                    201811
__cpp_lib_as_const                           201510
__cpp_lib_atomic_is_always_lock_free         201603
__cpp_lib_bool_constant                      201505
__cpp_lib_boyer_moore_searcher               201603
__cpp_lib_byte                               201603
__cpp_lib_chrono                             201907
__cpp_lib_clamp                              201603
__cpp_lib_enable_shared_from_this            201603
__cpp_lib_execution                          201902
__cpp_lib_filesystem                         201703
__cpp_lib_gcd_lcm                            201606
__cpp_lib_hardware_interference_size         201703
__cpp_lib_has_unique_object_representations  201606
__cpp_lib_hypot                              201603
__cpp_lib_incomplete_container_elements      201505
__cpp_lib_invoke                             201411
__cpp_lib_is_aggregate                       201703
__cpp_lib_is_invocable                       201703
__cpp_lib_is_swappable                       201603
__cpp_lib_launder                            201606
__cpp_lib_logical_traits                     201510
__cpp_lib_make_from_tuple                    201606
__cpp_lib_map_try_emplace                    201411
__cpp_lib_math_special_functions             201603
__cpp_lib_memory_resource                    201603
__cpp_lib_node_extract                       201606
__cpp_lib_nonmember_container_access         201411
__cpp_lib_not_fn                             201603
__cpp_lib_optional                           202110
__cpp_lib_parallel_algorithm                 201603
__cpp_lib_raw_memory_algorithms              201606
__cpp_lib_sample                             201603
__cpp_lib_scoped_lock                        201703
__cpp_lib_shared_mutex                       201505
__cpp_lib_shared_ptr_arrays                  201707
__cpp_lib_shared_ptr_weak_type               201606
__cpp_lib_string_view                        201803
__cpp_lib_to_chars                           201611
__cpp_lib_transparent_operators              201510
__cpp_lib_type_trait_variable_templates      201510
__cpp_lib_uncaught_exceptions                201411
__cpp_lib_unordered_map_try_emplace          201411
__cpp_lib_variant                            202106
__cpp_lib_void_t                             201411

C++20 CORE
__cpp_aggregate_paren_init                   201902
__cpp_char8_t                                202207
__cpp_concepts                               202002
__cpp_conditional_explicit                   201806
__cpp_consteval                              201811
__cpp_constexpr                              202002
__cpp_constexpr_dynamic_alloc                201907
__cpp_constexpr_in_decltype                  ------
__cpp_constinit                              201907
__cpp_deduction_guides                       201907
__cpp_designated_initializers                201707
__cpp_generic_lambdas                        201707
__cpp_impl_coroutine                         201902
__cpp_impl_destroying_delete                 201806
__cpp_impl_three_way_comparison              201907
__cpp_init_captures                          201803
__cpp_modules                                201907
__cpp_nontype_template_args                  201911
__cpp_using_enum                             201907

C++20 LIB
__cpp_lib_array_constexpr                    201811
__cpp_lib_assume_aligned                     201811
__cpp_lib_atomic_flag_test                   201907
__cpp_lib_atomic_float                       201711
__cpp_lib_atomic_lock_free_type_aliases      201907
__cpp_lib_atomic_ref                         201806
__cpp_lib_atomic_shared_ptr                  201711
__cpp_lib_atomic_value_initialization        201911
__cpp_lib_atomic_wait                        201907
__cpp_lib_barrier                            201907
__cpp_lib_bind_front                         201907
__cpp_lib_bit_cast                           201806
__cpp_lib_bitops                             201907
__cpp_lib_bounded_array_traits               201902
__cpp_lib_char8_t                            201907
__cpp_lib_chrono                             201907
__cpp_lib_concepts                           202002
__cpp_lib_constexpr_algorithms               201806
__cpp_lib_constexpr_complex                  201711
__cpp_lib_constexpr_dynamic_alloc            201907
__cpp_lib_constexpr_functional               201907
__cpp_lib_constexpr_iterator                 201811
__cpp_lib_constexpr_memory                   202202
__cpp_lib_constexpr_numeric                  201911
__cpp_lib_constexpr_string                   201907
__cpp_lib_constexpr_string_view              201811
__cpp_lib_constexpr_tuple                    201811
__cpp_lib_constexpr_utility                  201811
__cpp_lib_constexpr_vector                   201907
__cpp_lib_coroutine                          201902
__cpp_lib_destroying_delete                  201806
__cpp_lib_endian                             201907
__cpp_lib_erase_if                           202002
__cpp_lib_execution                          201902
__cpp_lib_format                             202207
__cpp_lib_generic_unordered_lookup           201811
__cpp_lib_int_pow2                           202002
__cpp_lib_integer_comparison_functions       202002
__cpp_lib_interpolate                        201902
__cpp_lib_is_constant_evaluated              201811
__cpp_lib_is_layout_compatible               201907
__cpp_lib_is_nothrow_convertible             201806
__cpp_lib_is_pointer_interconvertible        201907
__cpp_lib_jthread                            201911
__cpp_lib_latch                              201907
__cpp_lib_list_remove_return_type            201806
__cpp_lib_math_constants                     201907
__cpp_lib_polymorphic_allocator              201902
__cpp_lib_ranges                             202207
__cpp_lib_remove_cvref                       201711
__cpp_lib_semaphore                          201907
__cpp_lib_shared_ptr_arrays                  201707
__cpp_lib_shift                              202202
__cpp_lib_smart_ptr_for_overwrite            202002
__cpp_lib_source_location                    201907
__cpp_lib_span                               202002
__cpp_lib_ssize                              201902
__cpp_lib_starts_ends_with                   201711
__cpp_lib_string_view                        201803
__cpp_lib_syncbuf                            201803
__cpp_lib_three_way_comparison               201907
__cpp_lib_to_address                         201711
__cpp_lib_to_array                           201907
__cpp_lib_type_identity                      201806
__cpp_lib_unwrap_ref                         201811

C++23 CORE
__cpp_if_consteval                           ------
__cpp_size_t_suffix                          ------

C++23 LIB
__cpp_lib_constexpr_typeinfo                 202106
__cpp_lib_invoke_r                           202106
__cpp_lib_is_scoped_enum                     202011
__cpp_lib_stacktrace                         202011
__cpp_lib_stdatomic_h                        202011
__cpp_lib_string_contains                    202011
__cpp_lib_to_underlying                      202102
__cpp_lib_variant                            202106

ATTRIBUTES
carries_dependency                           ------
deprecated                                   ------
fallthrough                                  ------
likely                                       ------
maybe_unused                                 ------
nodiscard                                    ------
noreturn                                     ------
no_unique_address                            ------
unlikely                                     ------

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/436718.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【字符串处理】

目录 总结&#xff1a; 只要一做字符串的题目必出bug&#xff0c; 本蒟蒻还是要开个专题写一下……懒狗直接引用chatgpt 在C中&#xff0c;我们可以使用以下几种方式进行字符串的输入&#xff1a; 1.使用输入运算符(>>): 可以按照空格分隔符把一个标准字符串(即不包含…

引用的底层原理(汇编指令),引用与指针的联系与区别

TIPS 2. 3. 4. 引用的底层本质 在语法层面上的话&#xff0c;这个引用是不开空间的&#xff0c;相当于是对一个变量进行一个取别名的这么一个操作。在底层实现上实际是有空间的&#xff0c;因为引用是按照指针方式来实现的。然而如果你从底层的角度去看的话&#xff0c;因…

两小时让你全方位的认识文件(完结)

上期阿博给友友们讲了一些关于文件的一些读写操作&#xff0c;这期给友友们分享一下二进制的方式和文件操作的一些误区&#xff0c;下面来跟着阿博走进文件吧&#x1f917;&#x1f917;&#x1f917; 文章目录 一.fread和fwrite功能介绍二.文件的随机读写三.文本文件和二进制文…

17.网络爬虫—Scrapy入门与实战

这里写目录标题 Scrapy基础Scrapy运行流程原理Scrapy的工作流程Scrapy的优点 Scrapy基本使用(豆瓣网为例)创建项目创建爬虫配置爬虫运行爬虫如何用python执行cmd命令数据解析打包数据打开管道pipeline使用注意点 后记 前言&#xff1a; &#x1f3d8;️&#x1f3d8;️个人简介…

第一章Git学习(尚硅谷新版Git快速入门)

文章目录 为什么要学习Git为什么要学习Git软件为什么要学习Git软件Git基础概念版本控制集中式、分布式版本控制的区别Git工作区域Git分支 版本号什么是版本号文件操作对应的版本号分支操作对应的原理 命令行操作Git相关配置的指令获取当前Git的配置信息名称和邮箱 Git文件操作相…

随笔-你买罐头干什么

生产环境不太稳定&#xff0c;正在挠头&#xff0c;想着怎么能解决这个问题。 聊天工具上突然弹出一张图片&#xff0c;是个不认识的人&#xff08;暂且称为Z&#xff09;发的。点进去一看&#xff0c;是从一个表格截取的一条数据&#xff0c;内容是我某次加班餐的订单。 Z&a…

带头单向链表源码及相关练习

目录 移除链表元素 链表的中间节点 链表倒数第k个节点 合并两个有序链表 相交链表 环形链表 环形链表2 分割链表 回文链表 public class MySingleList {//内部类的使用class ListNode {public int val;public ListNode next;public ListNode(int val) {this.val val;}…

Java基础:容器知识点

目录 1、Java容器都有哪些&#xff1f; 2、Collection 和 Collections 区别&#xff1f; 3、List、Set、Map 间的区别&#xff1f; 4、HashMap 和 Hashtable 区别&#xff1f; 5、如何决定用 HashMap 还是 TreeMap&#xff1f; 6、HashMap 的实现原理&#xff1f; 7、说…

浮点型在内存中的存储

常见的浮点数&#xff1a; 3.14159 1E10&#xff08;科学计数法&#xff1a;1.0*10^10&#xff09; 浮点数家族包括&#xff1a; float、double、long double 类型 浮点数表示的范围&#xff1a;float.h中定义 下面举一个例子&#xff1a; int main() {int n 9;float *pFloat…

动态规划专练(一)

文章目录 前言一、斐波那契数1.题目介绍2.思路3.代码 二、爬楼梯1.题目介绍2.思路3.代码 三、使用最小花费爬楼梯1.题目介绍2.思路3.代码 前言 此篇为动态规划的初阶篇&#xff0c;所以比较简单&#xff0c;适合刚入门的新手学&#xff0c;如果你已经入门了&#xff0c;就无需看…

[LeetCode]杨辉三角

给定一个非负整数 numRows&#xff0c;生成「杨辉三角」的前 numRows 行。 在「杨辉三角」中&#xff0c;每个数是它左上方和右上方的数的和。 给定一个非负整数 numRows&#xff0c;生成「杨辉三角」的前 numRows 行。 在「杨辉三角」中&#xff0c;每个数是它左上方和右上…

(三)Python-tkinter桌面应用(爱心雨)

&#xff08;三&#xff09;Python-tkinter桌面应用&#xff08;爱心雨&#xff09; 一、前言 我们已经了解到tkinter可以制作爱心&#xff0c;弹幕&#xff0c;为了能让他看起来更加的充满心意&#xff0c;于是&#xff0c;我们决定将他制作为爱心雨。让它看起来更加的特别&a…

字节测试总监深度剖析,都2023年了,测试用例还不重视起来

​ 测试用例对于测试工作的作用&#xff1a; 1、指导测试的实施 测试用例主要适用于集成测试、系统测试和回归测试。在实施测试时测试用例作为测试的标准&#xff0c;测试人员一定要按照测试用例严格按用例项目和测试步骤逐一实施测试。并对测试情况记录在测试用例管理软件中…

超长JVM总结,面试必备

目录 什么是JVM JVM内存区域 JVM运行时内存(jdk1.7) 垃圾回收与算法 分代收集算法 GC 分代收集算法 VS 分区收集算法 GC 垃圾收集器 什么是JVM JVM 是可运行 Java 代码的假想计算机 &#xff0c;包括一套字节码指令集、一组寄存器、一个栈、一个垃圾回收&#xff0c;…

ChatGPT已死?AutoGPT太强?

今天聊聊 AutoGPT。 OpenAI 的 Andrej Karpathy 都大力宣传&#xff0c;认为 AutoGPT 是 prompt 工程的下一个前沿。 近日&#xff0c;AI 界貌似出现了一种新的趋势&#xff1a;自主人工智能。 这不是空穴来风&#xff0c;最近一个名为 AutoGPT 的研究开始走进大众视野。特斯拉…

PYTHON中的常见离散分布

1.什么是伯努利分布&#xff1f; 伯努利分布是一种二元随机变量的概率分布&#xff0c;其中一个结果的概率为p&#xff0c;另一个结果的概率为1-p。伯努利分布通常用于模拟二项分布&#xff0c;其中n个独立的伯努利试验被执行&#xff0c;每个试验有两个可能的结果&#xff08…

Unity VFX -- (5)VFX Graph基础

在Unity中&#xff0c;还有一种完全不同的创建VFX的工作流&#xff0c;VFX Graph。VFX Graph能够生成出和粒子系统相同或更好的效果。 相比于粒子系统&#xff0c;VFX Graph的一个最大的好处是它能够在保持应用良好性能的情况下&#xff0c;模拟出多得多的粒子。对于VFX艺术家来…

人生是一个长期的均值回归

到了现在这个阶段&#xff0c;总想说点什么。 我一直觉得记录并收藏每个阶段的状态是一件很有意义且奇妙的事&#xff0c;尤其是多少年后还能清晰地回忆其当初的心境&#xff0c;联想到曾经所设立的一些目标以及为之做出的努力&#xff0c;这些人生经历的脉纹清晰而完整&#x…

机器学习算法 KNN

文章目录 一、概述二、代码实现三、K值的选择四、距离计算五、总结1. K-近邻算法2. 优缺点 一、概述 k-近邻算法&#xff08;k-Nearest Neighbour algorithm&#xff09;&#xff0c;又称为KNN算法&#xff0c;是数据挖掘技术中原理最简单的算法。 KNN的工作原理&#xff1a;…

QT学习笔记6

一.QLable控件使用&#xff1a; 创建控件&#xff1a; 方式一&#xff1a;代码 文本&#xff1a; QLabel *labelnew QLabel(this);//建立标签 label->setText("这是代码创建标签"); 超链接&#xff1a; label->setText("<h1><a href\"h…