What is c++17?
C++17 (or C++1z) is the informal name for the next revision of the ISO/IEC standard for the C++ programming language after c++14. C++17 is feature complete now and on its way to becoming an international standard. It’s specification reached the Draft International Standard stage in March 2017. Below is Standardization chart of c++.
Standardization Chart of C++17
Year | C++ Standard | Informal name |
1998 | ISO/IEC 14882:1998 | C++98 |
2003 | ISO/IEC 14882:2003 | C++03 |
2011 | ISO/IEC 14882:2011 | C++11 |
2014 | ISO/IEC 14882:2014 | C++14 |
2017 | Yet to be determined | C++17 |
2020 | Yet to be determined | C++20 |
New Features of C++17
- Making the text message for static_assert optional
- Removal of trigraphs
- Allow type name (as an alternative to class) in a template parameter
- New rules for auto deduction from braced-init-list
- Nested namespace definitions, e.g., namespace X::Y { … } instead of namespace X { namespace Y { … }}
- Allowing attributes for namespaces and enumerators
- New standard attributes [[fallthrough]], [[maybe_unused]] and [[nodiscard]]
- UTF-8 character literals
- Constant evaluation for all non-type template arguments
- Fold expressions, for variadic templates
- A compile-time static if with the form if constexpr(expression)
- Structured binding declarations, allowing auto [a, b] = getTwoReturnValues();
- Initializers in if and switch statements
- Guaranteed copy elision by compilers in some cases
- Some extensions on over-aligned memory allocation
- Template deduction of constructors, allowing std::pair(5.0, false) instead of std::pair<double,bool>(5.0, false)
- Inline variables, which allows the definition of variables in header files
- __has_include, allowing the availability of a header to be checked by preprocessor directives
- Value of __cplusplus changed to 201703L
Also Read: C++ Where Is It Heading? And What are the New Features in C++ 17