15static_assert(__cplusplus == 201402,
"");
17#include <bits/stdc++.h>
26#define static_assert(a) static_assert(a, "")
27static_assert(__cpp_return_type_deduction);
96static_assert(__cpp_variable_templates);
100T
pi = T(3.141592653589793238462643383);
109 assert(pi<int> == 3);
112 auto binary_literal = 0b0100'1100'0110;
114 auto integer_literal = 1'000'000;
116 auto floating_point_literal = 0.000'015'3;
120 auto str =
"hello world"s;
127 static_assert(is_null_pointer<
decltype(
nullptr)>::value);
128 static_assert(is_null_pointer<nullptr_t>::value);
129 static_assert(__cpp_decltype);
130 static_assert(is_integral<int>());
133 tuple<string, string, int> tuple_by_type(
"foo",
"bar", 7);
135 int i = get<int>(tuple_by_type);
138 int j = get<2>(tuple_by_type);
143 static_assert(__cpp_decltype_auto);
144 decltype(
auto) a_copy = a;
145 assert(&a_copy != &a);
146 decltype(
auto)
a_ref = (a);
147 assert(&
a_ref == &a);
151 auto u = make_unique<int>(1);
154 auto ua = make_unique<int[]>(3);
167 static_assert(__cpp_generic_lambdas);
168 auto generic_lambda = [](
auto x) {
return x; };
170 auto universal_size = [](
const auto& m) {
return m.size(); };
172 static_assert(__cpp_init_captures);
173 auto capture_initializers = [value = 1] {
return value; };
175 assert(capture_initializers() == 1);
177 auto mutable_lambda = [value = 1] ()
mutable {
return ++value; };
179 assert(mutable_lambda() == 2);
180 assert(mutable_lambda() == 3);
184 auto change_c = [value = ++c] { };
187 unique_ptr<int> ptr(
new int(10));
188 auto capture_by_move = [value = move(ptr)] {
return *value; };
195 array<int, 10> s = {5, 7, 4, 2, 8, 6, 1, 9, 0, 3};
196 sort(s.begin(), s.end(),
auto & deduced_return_type_template(T &t)
auto deduced_return_type(int a)
auto implicit_int_return_type()
auto deduced_return_type_lambda
void return_type_deduction_demo()
void sort_14()
Compare with lambda::sort_11.
int & a_ref(int &a)
https://en.cppreference.com/w/cpp/language/reference
T pi
Binary literals, digit separators.
const char * pi< const char * >