15static_assert(__cplusplus >= 201707);
17#include <bits/stdc++.h>
27#if __cpp_lib_three_way_comparison
28static_assert(1 <=> 2 < 0 );
29static_assert(2 <=> 1 > 0 );
30static_assert(1 <=> 1 == 0 );
32#pragma message("undefined __cpp_lib_three_way_comparison")
47 struct point {
int x, y; };
48 struct line { point a, b; };
52#if __cplusplus > 201707
53 point p1 = { .x = 1 };
61#if __cpp_aggregate_paren_init >= 201902
70 line l3 = { 1, 2, 3, 4 };
78 cout << typeid(bit_cast<double>(0));
86 auto a = make_shared<int[10]>();
87 static_assert(is_same_v<
decltype(a.get()),
int*>);
90 map<int, int> m = {{2,3}};
91#if __cplusplus > 201707 && __GNUG__ > 8
92 assert(m.contains(2));
96 vector<int> v = {11, 12, 13};
97 assert(erase_if(v, [](
int a) {
return a >= 13;}) == 1);
98 assert(v.size() == 2);
104#if __cpp_template_template_args && __GNUG__ > 8
106template <
typename ... Args>
107auto make_lambda_with_parameter_pack_capture(Args&& ... args)
109 return [... args = forward<Args>(args)] {
117#if __cplusplus >= 201709
119 auto glambda = []<
class T>(T a, auto&& b) {
return a < b; };
120 assert(glambda(1,2));
122 auto f = []<
typename ...Ts>(Ts&& ...ts) {
127 struct point {
int x, y; };
128 auto point_lambda = []<
class T=point>(T&& var) {};
129 point_lambda({1, 2});
131 #if __cpp_template_template_args && __GNUG__ > 8
132 assert(make_lambda_with_parameter_pack_capture(1,2,3)() == 6);
169template <
typename T>
requires is_integral_v<T> T
constexpr requires_demo(T a) {
return a + 1; }
177template <
typename T>
auto constexpr requires_demo(T && a)
requires is_same_v<T, double> {
return 2; }
183is_signed_v<T> || (is_unsigned_v<T> && ! is_void_v<void>)