C++17 standard officially released: Developers can more easily write & maintain code


Yesterday, the ISO C ++ Committee formally released the C ++ 17 standard, formally known as ISO/IEC 14882:2017.


Based on C ++ 11, C ++ 17 is designed to make C ++ a less bloated and complicated programming language that simplifies the everyday use of the language, making it easier for developers to write and maintain code.

C ++ 17 is a major update to the C ++ language, introducing many new language features:

  • UTF-8 character text
  • Fold expressions: Used for mutable templates
  • Inline variables (inline variables): allows the definition of variables in the header file
  • Variables can be initialized within if and switch statements
  • Structured Binding:for (auto [key,value] : my_map) {…}
  • Class Template Argument Deduction:  pair p{1, 2.0};Replace with pair<int, double>{1, 2.0};

In addition, C ++ 17 brings with it other features such as parallel STLs, file system libraries derived from Boost.

As the new key “vocabulary type” in the standard library, std::string_viewand  std::optional will be widely used as a function parameter and return type. This allows developers to write simpler signatures, for example: std::string_viewTemplatizing can be used for string types  ; developers can use class std::variantand  std::anytype more as a class member in a function body  and use it internally.

The Clang compiler for LLVM has also changed the place where “C ++ 1z” appears in the code to “C ++ 17” (C ++ 17 was once called C ++ 1z). Both GCC and LLVM / Clang effectively provide complete C ++ 17 support.

For the ongoing C++ 20, it is expected to complete all features within two years (summer 2019).

Leave a Reply

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