Skip to content

C++17

C++17 (ISO/IEC 14882:2017) is a major update that introduces a large number of highly practical language features and library components, further improving the expressiveness and safety of C++.

Core Features

Language Level

FeatureDescription
Structured Bindingsauto [x, y] = pair;
if constexprCompile-time branching, replacing SFINAE hacks
Fold Expressions(args + ...) simplifies variadic templates
Class Template Argument Deduction (CTAD)pair p(1, 2.0); no explicit template arguments needed
Inline VariablesThe correct way to define global variables in header files
Nested Namespacesnamespace A::B::C {}
[[nodiscard]] / [[maybe_unused]] / [[fallthrough]]More attributes

Standard Library Level

ComponentDescription
std::optionalValue-semantic container that may be empty
std::variantType-safe union
std::anyContainer for any type
std::string_viewNon-owning string view, zero-copy
<filesystem>Standardized filesystem operations
Parallel Algorithmsstd::execution::par execution policies
std::applyApply function to tuple
std::byteType-safe byte type
std::clampNumeric clamping
std::invokeUnified call syntax
std::from_chars / std::to_charsHigh-performance numeric conversion
std::conjunction / disjunction / negationType trait logical composition

Design Philosophy

The design philosophy of C++17 can be summarized as "practicality first":

  • Eliminate boilerplate: Structured bindings and CTAD reduce redundant declarations
  • Zero-overhead abstractions: string_view and optional introduce no runtime overhead
  • Compile-time capabilities: if constexpr makes template code more readable
  • Safety: [[nodiscard]] helps catch ignored return values

Compiler Support

CompilerFull Support Version
GCC9+
Clang8+
MSVCVS 2019 (16.0)+

Further Reading

Released under the MIT License