void print(std::string_view sv) std::cout << sv;
Allows declaring a variable scoped to the statement. c++ 2017
std::optional<int> parse_int(const std::string& s) try return std::stoi(s); catch(...) return std::nullopt; void print(std::string_view sv) std::cout <
g++ -std=c++17 program.cpp clang++ -std=c++17 program.cpp cl /std:c++17 program.cpp # MSVC C++17 is often described as a "quality-of-life" release because it addressed many everyday pain points without introducing radical new paradigms (unlike C++11 or C++20). It made C++ more approachable and efficient, and most codebases quickly adopted its features. parse_int(const std::string& s) try return std::stoi(s)
template<typename... Args> auto sum(Args... args) return (args + ...); // right fold
Compile-time conditional compilation inside templates, discarding non-taken branches entirely.
std::any a = 42; int value = std::any_cast<int>(a); Non-owning reference to a string-like sequence. Ideal for function parameters.