C++17
From Wikipedia, the free encyclopedia
C++17 (or C++1z) is the informal name for the next revision of the ISO/IEC standard for the C++ programming language. The C++17 specification reached the Draft International Standard stage in March 2017,[1][2] and is not expected to undergo any major changes before publication of the final standard later in the year.
Expected features[edit]
Language[edit]
- Making the text message for
static_assertoptional[3]
- Allow
typename(as an alternative toclass) in a template template parameter[6]
- Nested namespace definitions, e.g.,
namespace X::Y { … }instead ofnamespace X { namespace Y { … }}[8][9]
- New standard attributes
[[fallthrough]],[[maybe_unused]]and[[nodiscard]][12]
- A compile-time static
ifwith the formif constexpr(expression)[18]
- Structured binding declarations, allowing
auto [a, b] = getTwoReturnValues();[19]
- Initializers in
ifandswitchstatements[20]
- copy-initialization and direct-initialization of objects of type
Tfrom prvalue expressions of typeT(ignoring top-level cv-qualifiers) shall result in no copy or move constructors from the prvalue expression.
- Some extensions on over-aligned memory allocation[21]
- Template deduction of constructors, allowing
std::pair(5.0, false)instead ofstd::pair<double,bool>(5.0, false)
- Inline variables, which allows the definition of variables in header files
__has_include, allowing the availability of a header to be checked by preprocessor directives[22]
- Value of
__cpluspluschanged to201703L[23]
Library[edit]
- Most of Library Fundamentals TS I, including:[24][25]
std::string_view, a read-only non-owning reference to a character sequence or string-slice[26]std::optional, for representing optional objectsstd::any, for holding single values of any type
- New insertion functions
try_emplaceandinsert_or_assignforstd::mapandstd::unordered_map[28][29]
- Removal of some deprecated types and functions, including
std::auto_ptr,std::random_shuffle, and old function adaptors[8][32]
- A file system library based on
boost::filesystem[33]
- Parallel versions of STL algorithms[34]
- Additional mathematical special functions, including elliptic integrals and Bessel functions[35]
std::variant, a tagged union container[36]
std::byte[37]
- Logical operator traits:
std::conjunction,std::disjunctionandstd::negation[38]
Next standard[edit]
See also[edit]
References[edit]
- ^ "N4661 Editors' Report -- Programming Languages -- C++". 21 March 2017. Retrieved 2017-03-21.
- ^ "ISO/IEC DIS 14882: Programming Languages — C++" (PDF).
- ^ "N3928: Extending static_assert, v2 (Walter E. Brown)" (PDF).
- ^ "N3981: Removing trigraphs??! (Richard Smith)". 2014-05-06.
- ^ IBM comment on preparing for a Trigraph-adverse future in C++17, IBM paper N4210, 2014-10-10. Authors: Michael Wong, Hubert Tong, Rajan Bhakta, Derek Inglis
- ^ "N4051: Allow typename in a template template parameter (Richard Smith)".
- ^ "N3922: New Rules for auto deduction from braced-init-list (James Dennett)".
- ^ a b c "Updates to my trip report".
- ^ "N4230: Nested namespace definition (Robert Kawulak, Andrew Tomazos)".
- ^ a b c d e "New core language papers adopted for C++17".
- ^ "N4266: Attributes for namespaces and enumerators (Richard Smith)".
- ^ "N4640: Working Draft, Standard for Programming Language C++" (PDF). pp. 193–195.
- ^ "N4267: Adding u8 character literals (Richard Smith)".
- ^ Thomas Köppe. "Hexadecimal floating literals for C++".
- ^ "N4659: Working Draft, Standard for Programming Language C++" (PDF). §5.13.4.
- ^ "N4268: Allow constant evaluation for all non-type template arguments (Richard Smith)".
- ^ "N4295: Folding expressions (Andrew Sutton, Richard Smith)".
- ^ "N4659: Working Draft, Standard for Programming Language C++" (PDF). §9.4.1.
- ^ "N4659: Working Draft, Standard for Programming Language C++" (PDF). §11.5.
- ^ "If statement with initializer".
- ^ "Dynamic memory allocation for over-aligned data".
- ^ "N4640: Working Draft, Standard for Programming Language C++" (PDF). pp. 431–433.
- ^ "N4659: Working Draft, Standard for Programming Language C++" (PDF). §19.8.
- ^ "Adopt Library Fundamentals V1 TS Components for C++17 (R1)".
- ^ "Current Status".
- ^ "std::basic_string_view - cppreference.com". en.cppreference.com. Retrieved 2016-06-23.
- ^ "N4259: Wording for std::uncaught_exceptions (Herb Sutter)" (PDF).
- ^ "N4279: Improved insertion interface for unique-key maps (Thomas Köppe)".
- ^ a b c "New standard library papers adopted for C++17".
- ^ "N4280: Non-member size() and more (Riccardo Marcangelo)" (PDF).
- ^ "N4284: Contiguous Iterators (Jens Maurer)".
- ^ "N4190: Removing auto_ptr, random_shuffle(), And Old <functional> Stuff (Stephan T. Lavavej)".
- ^ "Filesystem Library Proposal (Beman Dawes)".
- ^ "The Parallelism TS Should be Standardized".
- ^ "Mathematical Special Functions for C++17, v5" (PDF).
- ^ "N4659: Working Draft, Standard for Programming Language C++" (PDF). §23.7.
- ^ "A byte type definition" (PDF).
- ^ "N4659: Working Draft, Standard for Programming Language C++" (PDF). §23.15.8.
- ^ https://herbsutter.com/2016/06/30/trip-report-summer-iso-c-standards-meeting-oulu/ "the next standard after C++17 will be C++20"
- ^ "Current Status : Standard C++".