Top 19 New Features of C++17 you need to know about it.

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

YearC++ StandardInformal name
1998ISO/IEC 14882:1998C++98
2003ISO/IEC 14882:2003C++03
2011ISO/IEC 14882:2011C++11
2014ISO/IEC 14882:2014C++14
2017Yet to be determinedC++17
2020Yet to be determinedC++20

New Features of C++17

  1. Making the text message for static_assert optional
  2. Removal of trigraphs
  3. Allow type name (as an alternative to class) in a template parameter
  4. New rules for auto deduction from braced-init-list
  5. Nested namespace definitions, e.g., namespace X::Y { … } instead of namespace X { namespace Y { … }}
  6. Allowing attributes for namespaces and enumerators
  7. New standard attributes [[fallthrough]], [[maybe_unused]] and [[nodiscard]]
  8. UTF-8 character literals
  9. Constant evaluation for all non-type template arguments
  10. Fold expressions, for variadic templates
  11. A compile-time static if with the form if constexpr(expression)
  12. Structured binding declarations, allowing auto [a, b] = getTwoReturnValues();
  13. Initializers in if and switch statements
  14. Guaranteed copy elision by compilers in some cases
  15. Some extensions on over-aligned memory allocation
  16. Template deduction of constructors, allowing std::pair(5.0, false) instead of std::pair<double,bool>(5.0, false)
  17. Inline variables, which allows the definition of variables in header files
  18. __has_include, allowing the availability of a header to be checked by preprocessor directives
  19. Value of __cplusplus changed to 201703L

Also Read: C++ Where Is It Heading? And What are the New Features in C++ 17

Leave a Reply