C++ | 2017

C++ | 2017

template<auto N> struct Foo ; Foo<42> f1; Foo<'c'> f2; 3.1 std::optional<T> A type-safe wrapper that may or may not hold a value.

Compile-time conditional compilation inside templates, discarding non-taken branches entirely. c++ 2017

Memory resources for container allocators, enabling custom memory management without recompiling container code. 3.8 std::clamp , std::gcd , std::lcm int x = std::clamp(5, 0, 10); // 5 int g = std::gcd(12, 18); // 6 3.9 Splicing for Maps and Sets Extract and insert nodes from associative containers without reallocation. std::lcm int x = std::clamp(5

std::any a = 42; int value = std::any_cast<int>(a); Non-owning reference to a string-like sequence. Ideal for function parameters. // 5 int g = std::gcd(12