C 17 Features in C 1z Compilers
C 17 is now feature complete, and compilers supporting "C 1z" will implement most of the features added in C 17. Some of the key features that will be available in C 1z compilers include:
Language Features:
- Template argument deduction for class templates
- template
- Non-type template arguments fixes
- templatetypename bob> struct foo {}
- ( Folding ... expressions ) with revisions
- auto x{8}; is an int
- Modernizing using with ... and lists
Lambda:
- Constexpr lambdas
- Capturing *this in lambdas
Attributes:
- [[fallthrough]], [[nodiscard]], [[maybe_unused]] attributes
- [[attributes]] on namespaces and enumerators
Syntax Cleanup:
- Inline variables
- Cleaner multi-return and flow control with structured bindings and if (init; condition) syntax
Data Types:
- std::variant
- std::optional
- std::any
- std::string_view
Invoke Stuff:
- std::invoke
- std::apply
- std::make_from_tuple
- is_invocable, is_invocable_r, and invoke_result
File System TS v1:
- File I/O-related classes and functions
Algorithms:
- New algorithms such as for_each_n, reduce, and transform_reduce
Threading:
Library Fundamentals TS v1:
- Searching algorithms and techniques
- Polymorphic allocator (std::pmr)
- Container improvements including splicing and non-member std::size
Smart Pointers:
Other Changes:
- C 17 library is based on C11 instead of C99
- Special math functions
- std::clamp
- std::void_t
Note: Please consult the compiler documentation for the exact list of C 17 features supported by your specific compiler.
The above is the detailed content of What C 17 Features are Implemented in C 1z Compilers?. For more information, please follow other related articles on the PHP Chinese website!