C++ 2017 [patched] -
std::map<int, std::string> m = 1, "a"; for (const auto& [key, val] : m) // key = 1, val = "a" std::cout << key << ": " << val << '\n';
if (auto it = m.find(key); it != m.end()) // use it here // it goes out of scope Permits defining variables in header files without violating the One Definition Rule (ODR). Essential for header-only libraries. c++ 2017
print("temporary"); // no allocation Most STL algorithms gained execution policy overloads: seq , par , par_unseq . std::map<int, std::string> m = 1, "a"; for (const
std::any a = 42; int value = std::any_cast<int>(a); Non-owning reference to a string-like sequence. Ideal for function parameters. std::any a = 42; int value = std::any_cast<int>(a);
template<typename... Args> auto sum(Args... args) return (args + ...); // right fold
std::optional<int> parse_int(const std::string& s) try return std::stoi(s); catch(...) return std::nullopt;