Cpp17 (CloudMonk.io)
CPP17 - C++ 17
Return to CPP | C++: CPP Standards, CPP11 | C++11, CPP14 | C++14, CPP20 | C++20 and CPP23 | C++23
C++17, formally known as ISO/IEC 14882:2017, introduced a suite of features aimed at simplifying code, improving performance, and enhancing the type safety of C++ programs. This summary, presented in MediaWiki format, outlines the significant updates and improvements incorporated into C++17.
Structured Bindings
C++17 introduced structured bindings, allowing developers to unpack elements from tuples, pairs, and struct-like objects into separate named variables, simplifying code that works with tuple-based return types.
`if` and `switch` with Initializers
This feature allows an initializer to be included in `if` and `switch` statements, promoting more concise code by limiting the scope of variables used in conditions.
Inline Variables
C++17's inline variables facilitate the definition of variables in header files without leading to multiple definition errors, a boon for header-only libraries and shared constants.
`constexpr` Lambda Expressions
Expanding the contexts in which `constexpr` can be used, C++17 enables lambda expressions to be evaluated at compile time, enhancing the language's metaprogramming capabilities.
`std::optional`, `std::variant`, and `std::any`
These types introduce more expressive ways to handle optional, type-safe union, and type-erased values, respectively, making error handling and variant type management more straightforward.
Filesystem Library
The inclusion of the `` library provides a standard way to perform file and directory operations, addressing a long-standing gap in the standard library.
Parallel Algorithms
C++17 added support for parallel execution of standard algorithms, allowing for easy utilization of multi-core processors for improved performance.
`std::string_view`
`std::string_view` offers a lightweight, non-owning view into a string, enabling more efficient string handling without unnecessary copies.
`std::apply` and `std::invoke`
These functions facilitate calling a function or callable object with arguments supplied in a tuple or derived from different types, streamlining the invocation of callable objects.
Fold Expressions
Fold expressions simplify the writing of variadic template functions by enabling easy accumulation or combination of all arguments passed to a template.
`std::byte`
The introduction of `std::byte` provides a type-safe way of representing byte data, distinct from character types, emphasizing its use for raw memory access.
These attributes allow developers to indicate that a function's return value should not be ignored and to suppress warnings for intentionally unused entities, improving code safety and cleanliness.
`std::clamp`
`std::clamp` offers a straightforward way to constrain a value within a specified range, enhancing the readability and simplicity of common boundary-checking operations.
Template Argument Deduction for Class Templates
This feature simplifies the use of templates by allowing the compiler to deduce the template arguments for constructors of class templates, reducing boilerplate code.
`std::shared_mutex`
`std::shared_mutex` and `std::shared_lock` introduce shared ownership locks, enabling more fine-grained control over read-write access in multithreaded applications.
`std::scoped_lock`
Replacing `std::lock_guard` with `std::scoped_lock` provides a more flexible way to handle multiple mutexes simultaneously, mitigating the risk of deadlock.
`std::variant` `std::visit`
Alongside `std::variant`, C++17 introduced `std::visit`, a mechanism to apply a visitor to a variant's currently held type, simplifying type-safe operations on variant types.
Guaranteed Copy Elision
C++17 specifies conditions under which the compiler must elide copies and moves of class objects, reducing unnecessary copying and moving, and potentially improving performance.
Removal of Trigraphs
The removal of trigraphs from C++17 eliminates a source of confusion and potential errors in code, streamlining the language's syntax.
Deprecated and Removed Features
C++17 deprecated and removed several features, such as `auto_ptr`, `register` keyword, and boolean ++ operator, to clean up the language and discourage unsafe or unclear practices.
Conclusion
C++17 represents a significant evolution of the C++ language, introducing features that enhance its usability, performance, and safety. By addressing both long-standing issues and adopting new programming paradigms, C++17 ensures the language's continued relevance and utility for modern software development.
For detailed information on C++17 features and technical specifications, the official ISO C++ website and the GitHub repository for the C++ Standards Committee's documents are invaluable resources. Unfortunately, direct links to these resources cannot be provided here, but they are readily accessible through official channels and repositories dedicated to the C++ standard.
This summary outlines the breadth of improvements and new features introduced in C++17, showcasing the standard's commitment to evolving in response to the needs of the programming community while maintaining backward compatibility and performance.
C Plus Plus | C++: Effective CPP | Effective C++, C Plus Plus Best Practices | C++ Best Practices, CPP Core Guidelines (CG) by Bjarne Stroustrup and Herb Sutter | C++ Core Guidelines (CG) by Bjarne Stroustrup and Herb Sutter, C Plus Plus Fundamentals | C++ Fundamentals, C Plus Plus Inventor | C++ Inventor - C Plus Plus Language Designer | C++ Language Designer: Bjarne Stroustrup in 1985; C Plus Plus Keywords | C++ Keywords, CPP Built-In Data Types | C++ Built-In Data Types, C Plus Plus Data Structures | C++ Data Structures (CPP Containers) - C Plus Plus Algorithms | C++ Algorithms, C Plus Plus Syntax | C++ Syntax, C Plus Plus OOP | C++ OOP - C Plus Plus Design Patterns | C++ Design Patterns, Clean C Plus Plus | Clean C++ - C Plus Plus Style Guide | C++ Style Guide - C Plus Plus BDD | C++ BDD, C Plus Plus Standards | C++ Standards (C Plus Plus 23 | C++ 23, C Plus Plus 20 | C++ 20, C Plus Plus 17 | C++ 17, C Plus Plus 14 | C++ 14, C Plus Plus 11 | C++ 11, C Plus Plus 03 | C++ 03, C Plus Plus 98 | C++ 98), Bjarne Stroustrup's C Plus Plus Glossary | Bjarne Stroustrup's C++ Glossary - Glossaire de CCP - French, CppReference.com, CPlusPlus.com, ISOcpp.org, C Plus Plus Compilers | C++ Compilers (Compiler Explorer, MinGW), C Plus Plus IDEs | C++ IDEs, C Plus Plus Development Tools | C++ Development Tools, C Plus Plus Linter | C++ Linter, C Plus Plus Debugging | C++ Debugging, C Plus Plus Modules | C++ Modules (C Plus Plus 20 | C++20), C Plus Plus Packages | C++ Packages, C Plus Plus Package Manager | C++ Package Manager (Conan - the C/C Plus Plus Package Manager | Conan - the C/C++ Package Manager), C Plus Plus Standard Library | C++ Standard Library, C Plus Plus Libraries | C++ Libraries, C Plus Plus Frameworks | C++ Frameworks, C Plus Plus DevOps | C++ DevOps - C Plus Plus SRE | C++ SRE, C Plus Plus CI/CD | C++ CI/CD (C Plus Plus Build Pipeline | C++ Build Pipeline), C Plus Plus Data Science | C++ Data Science - C Plus Plus DataOps | C++ DataOps, C Plus Plus Machine Learning | C++ Machine Learning, C Plus Plus Deep Learning | C++ Deep Learning, Functional C Plus Plus | Functional C++, C Plus Plus Concurrency | C++ Concurrency, C Plus Plus History | C++ History, C Plus Plus Topics | C++ Topics, C Plus Plus Bibliography | C++ Bibliography, Manning CPP Series | Manning C++ Series, C Plus Plus Courses | C++ Courses, CppCon, C Plus Plus Research | C++ Research, C Plus Plus GitHub | C++ GitHub, Written in C Plus Plus | Written in C++, C Plus Plus Popularity | C++ Popularity, C Plus Plus Awesome | C++ Awesome , C Plus Plus Versions | C++ Versions. (navbar_cplusplus -- see also navbar_cpp_containers, navbar_cppcon, navbar_cpp_core_guidelines, navbar_cpp23, navbar_cpp20, navbar_cpp17, navbar_cpp14, navbar_cpp11)
----
Cloud Monk is Retired (impermanence | for now). Buddha with you. Copyright | © Beginningless Time - Present Moment - Three Times: The Buddhas or Fair Use. Disclaimers
SYI LU SENG E MU CHYWE YE. NAN. WEI LA YE. WEI LA YE. SA WA HE.
----