15static_assert(__cplusplus == 201703);
17#include <bits/stdc++.h>
48template <
typename T =
float>
58#if __cpp_deduction_guides > 201611
105template<auto n>
struct B { };
120template <
auto...
seq>
171 return [n] {
return n + 1; }();
189 struct capture_value_o {
191 auto get_value_copy() {
192 return [*
this] {
return value; };
197 auto val = mo.get_value_copy();
239 scoped_lock l1(mt[0], mt[1]);
241 scoped_lock l2(mt[0], mt[1]);
258 static_assert(is_reference_v<int&>);
261 static_assert(is_lvalue_reference_v<int&>);
264 static_assert(is_rvalue_reference_v<int&&>);
273template<
typename... Args>
274constexpr bool folding_and(Args... args) {
return (
true && ... && args); }
276template<
typename... Args>
310static_assert(__cpp_structured_bindings);
319 auto& [a0_ref, a1_ref] = a;
325 unordered_map<string, int> mapping {
331 for (
const auto& [key, value] : mapping) {
337 auto [min, max] = minmax({3, 2, 1});
358 switch (
int a = 10) {
373[[nodiscard]]
int foo() {
return 0;}
383 [[maybe_unused]]
int b =
foo();
422 enum byte_e :
unsigned char {};
423 static byte_e b { 123 };
426 static_assert(is_integral_v<int>);
427 static_assert(__cpp_hex_float);
428 double hex_double = 0x1.2p3;
429 assert(hex_double == 9.0);
431 static_assert(is_invocable<
decltype(
types_17)>::value);
432 static_assert(is_invocable<int()>::value);
433 static_assert(is_invocable_r<int, int()>::value);
434 static_assert(is_invocable_r<void, void(
int),
int>::value);
435 static_assert(negation_v<bool_constant<false>>);
437 auto inc = [](
int a) ->
int {
return a + 1; };
438 static_assert(is_invocable_r<int,
decltype(
inc),
int>::value);
439 static_assert(__cpp_lib_invoke);
440 assert(invoke(
inc, 2) == 3);
455 map<int, string> m{{1,
"mango"}, {2,
"papaya"}, {3,
"guava"}};
456 auto nh = m.extract(2);
463 set<int> src {1, 3, 5};
464 set<int> dst {2, 4, 5};
478 variant<int, float> v, w;
490 }
catch (
const bad_variant_access&) {}
492 using namespace literals;
494 variant<string> x(
"abc");
499 variant<string, void const*> y(
"abc");
502 assert(holds_alternative<void const*>(y));
504 assert(holds_alternative<string>(y));
506 auto inc = [](
int a) ->
int {
return a + 1; };
507 assert(visit(
inc, (variant<int>)1) == 2);
512 static_assert(__cpp_lib_clamp);
514 assert(clamp(0, 1, 3) == 1);
515 assert(clamp(2, 1, 3) == 2);
516 assert(clamp(4, 1, 3) == 3);
522 unique_ptr<int[]> u1(d);
523 assert(u1.get()[0] == 10);
527 const shared_ptr<int> s1{0};
530 assert(
typeid(reinterpret_pointer_cast<shared_ptr<int>>(s1)).name()
531 ==
string(
"St10shared_ptrIS_IiEE"));
532 vector<int> s = {5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
537 static_assert(is_integral_v<remove_reference<
decltype(va[0])>::type>);
543 static_assert(__cpp_lib_string_view);
546 assert(v.data() == s.c_str());
547 assert(v.substr(1, 2).data() >= s.c_str());
548 assert(v.substr(1, 2).data() <= s.c_str() + s.length());
583 for (
auto&& [first, second] : mymap) {
constexpr int(* inc)(int)
constexpr int const_inc(int n)
constexpr bool folding_and(Args... args)
constexpr auto folding_sum(Args... args)
constexpr int const_if()
if
static char char_u8
character_literal
void conditional_with_init()
void capture_this_by_value()
void structured_bindings()
void deduction_guides_17()
template_struct template_arg_deduction
deducted <int>
constexpr pair deducted_pair(1, 2.3)
pair<int, double> p(1, 2.3);
constexpr tuple deducted_tuple(4, 2, 2.5)
auto t = make_tuple(4, 3, 2.5);
array deduction_guide_array
deduction_guides
vector deduction_guide2_vector
deduced vector<vector<int> :: iterator>
deque deduction_guide2_queue
deduced deque<vector<int> :: iterator>
deque deduction_guide1_queue(int_vector.begin(), int_vector.end())
deduction_guides
vector deduction_guide1_vector(int_vector.begin(), int_vector.end())
deduced vector<int>
tuple< int, int > foo_tuple()
auto seq
auto seq = integer_sequence<int, 0, 1, 2>();
Before: namespace outer_namespace { namespace nested_namespace { } }.
int in_qualified_nested_namespace
template with type float by default