C++ 2017 [repack] May 2026

std::optional<int> parse_int(const std::string& s) try return std::stoi(s); catch(...) return std::nullopt;

template <typename T> auto to_string(const T& t) if constexpr (std::is_integral_v<T>) return std::to_string(t); else return std::string(t); // only instantiated if T is not integral 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. parse_int(const std::string& s) try return std::stoi(s)

std::variant<int, float, std::string> v = "hello"; std::visit([](auto&& arg) std::cout << arg; , v); Type-erased container for any copyable type. catch(...) return std::nullopt

print("temporary"); // no allocation Most STL algorithms gained execution policy overloads: seq , par , par_unseq .