C++17 programming language features

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

Masalaa News on Google News

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

  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

Your email address will not be published. Required fields are marked *