This article has multiple issues. Please help
improve it or discuss these issues on the
talk page. (
Learn how and when to remove these template messages)
|
C++ language revisions |
---|
C++17 is a version of the ISO/ IEC 14882 standard for the C++ programming language. C++17 replaced the prior version of the C++ standard, called C++14, and was later replaced by C++20.
Before the C++ Standards Committee fixed a 3-year release cycle, C++17's release date was uncertain. In that time period, the C++17 revision was also called C++1z, following C++0x or C++1x for
C++11 and C++1y for
C++14. The C++17 specification reached the Draft International Standard (DIS) stage in March 2017.
[1]
[2] This DIS was unanimously approved, with only editorial comments,
[3] and the final standard was published in December 2017.
[4] Few changes were made to the C++
Standard Template Library, although some
algorithms in
the <algorithm>
header were given support for explicit
parallelization and some
syntactic enhancements were made.
C++17 introduced many new features. The following lists may be incomplete.
static_assert
optional
[5]typename
(as an alternative to class
) in a template template parameter
[6]auto
deduction from braced-init-list
[7]
[8]namespace X::Y { … }
instead of namespace X { namespace Y { … } }
[8]
[9][[fallthrough]]
, [[maybe_unused]]
and [[nodiscard]]
[12]u8
) character literals
[10]
[13] (UTF-8 string literals have existed since
C++11; C++17 adds the corresponding character literals for consistency, though as they are restricted to a single byte they can only store "
Basic Latin" and
C0 control codes, i.e.
ASCII)auto
as the type for a non-type template parameter
[16]if
with the form if constexpr(expression)
[19]auto a, b = getTwoReturnValues();
[20]if
and switch
statements
[21]T
from prvalue expressions of type T
(ignoring top-level cv-qualifiers) shall result in no copy or move constructors from the prvalue expression. See
copy elision for more information.std::pair(5.0, false)
instead of requiring explicit constructor arguments types std::pair<double, bool>(5.0, false)
or an additional helper template function std::make_pair(5.0, false)
.
[23]
[24]__has_include
, allowing the availability of a header to be checked by preprocessor directives
[25]__cplusplus
changed to 201703L
[26]std::string_view
, a read-only non-owning reference to a character sequence or
string-slice
[31]std::optional
, for representing
optional objects, a data type that may not always be returned by a given algorithm with support for non-returnstd::any
, for holding single values of any typestd::uncaught_exceptions
, as a replacement of std::uncaught_exception
in
exception handling
[32]
[10]try_emplace
and insert_or_assign
for std::map
and std::unordered_map
key-value associative data structures
[33]
[34]std::size
, std::empty
and std::data
[34]
[35]boost::filesystem
[37]std::variant
, a
tagged union container
[40]std::byte
, allowing
char to be replaced for data types intending to model a
byte of data as a byte rather than a character
[41]std::conjunction
, std::disjunction
and std::negation
[42]<memory_resource>
header, for polymorphic memory resources
[43]This revision of C++ not only added new features but also removed a few.
std::auto_ptr
, std::random_shuffle
, and old function adaptors.
[8]
[46] These were superseded in C++11 by improved facilities such as std::unique_ptr
, std::shuffle
, std::bind
, and lambdas.register
as a storage class specifier was removed.
[47] This keyword is still
reserved but now unused.This article has multiple issues. Please help
improve it or discuss these issues on the
talk page. (
Learn how and when to remove these template messages)
|
C++ language revisions |
---|
C++17 is a version of the ISO/ IEC 14882 standard for the C++ programming language. C++17 replaced the prior version of the C++ standard, called C++14, and was later replaced by C++20.
Before the C++ Standards Committee fixed a 3-year release cycle, C++17's release date was uncertain. In that time period, the C++17 revision was also called C++1z, following C++0x or C++1x for
C++11 and C++1y for
C++14. The C++17 specification reached the Draft International Standard (DIS) stage in March 2017.
[1]
[2] This DIS was unanimously approved, with only editorial comments,
[3] and the final standard was published in December 2017.
[4] Few changes were made to the C++
Standard Template Library, although some
algorithms in
the <algorithm>
header were given support for explicit
parallelization and some
syntactic enhancements were made.
C++17 introduced many new features. The following lists may be incomplete.
static_assert
optional
[5]typename
(as an alternative to class
) in a template template parameter
[6]auto
deduction from braced-init-list
[7]
[8]namespace X::Y { … }
instead of namespace X { namespace Y { … } }
[8]
[9][[fallthrough]]
, [[maybe_unused]]
and [[nodiscard]]
[12]u8
) character literals
[10]
[13] (UTF-8 string literals have existed since
C++11; C++17 adds the corresponding character literals for consistency, though as they are restricted to a single byte they can only store "
Basic Latin" and
C0 control codes, i.e.
ASCII)auto
as the type for a non-type template parameter
[16]if
with the form if constexpr(expression)
[19]auto a, b = getTwoReturnValues();
[20]if
and switch
statements
[21]T
from prvalue expressions of type T
(ignoring top-level cv-qualifiers) shall result in no copy or move constructors from the prvalue expression. See
copy elision for more information.std::pair(5.0, false)
instead of requiring explicit constructor arguments types std::pair<double, bool>(5.0, false)
or an additional helper template function std::make_pair(5.0, false)
.
[23]
[24]__has_include
, allowing the availability of a header to be checked by preprocessor directives
[25]__cplusplus
changed to 201703L
[26]std::string_view
, a read-only non-owning reference to a character sequence or
string-slice
[31]std::optional
, for representing
optional objects, a data type that may not always be returned by a given algorithm with support for non-returnstd::any
, for holding single values of any typestd::uncaught_exceptions
, as a replacement of std::uncaught_exception
in
exception handling
[32]
[10]try_emplace
and insert_or_assign
for std::map
and std::unordered_map
key-value associative data structures
[33]
[34]std::size
, std::empty
and std::data
[34]
[35]boost::filesystem
[37]std::variant
, a
tagged union container
[40]std::byte
, allowing
char to be replaced for data types intending to model a
byte of data as a byte rather than a character
[41]std::conjunction
, std::disjunction
and std::negation
[42]<memory_resource>
header, for polymorphic memory resources
[43]This revision of C++ not only added new features but also removed a few.
std::auto_ptr
, std::random_shuffle
, and old function adaptors.
[8]
[46] These were superseded in C++11 by improved facilities such as std::unique_ptr
, std::shuffle
, std::bind
, and lambdas.register
as a storage class specifier was removed.
[47] This keyword is still
reserved but now unused.