C 17
   HOME

TheInfoList



OR:

C++17 is a version of the
ISO ISO is the most common abbreviation for the International Organization for Standardization. ISO or Iso may also refer to: Business and finance * Iso (supermarket), a chain of Danish supermarkets incorporated into the SuperBest chain in 2007 * Iso ...
/
IEC The International Electrotechnical Commission (IEC; in French: ''Commission électrotechnique internationale'') is an international standards organization that prepares and publishes international standards for all electrical, electronic and r ...
14882 standard for the
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
programming language. C++17 replaced the prior version of the C++ standard, called
C++14 C++14 is a version of the ISO/IEC 14882 standard for the C++ programming language. It is intended to be a small extension over C++11, featuring mainly bug fixes and small improvements, and was replaced by C++17. Its approval was announced on Augus ...
, and was later replaced by
C++20 C20 or C-20 may refer to: Science and technology * Carbon-20 (C-20 or 20C), an isotope of carbon * C20, the smallest possible fullerene (a carbon molecule) * C20 (engineering), a mix of concrete that has a compressive strength of 20 newtons per sq ...
.


History

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 C++11 is a version of the ISO/ IEC 14882 standard for the C++ programming language. C++11 replaced the prior version of the C++ standard, called C++03, and was later replaced by C++14. The name follows the tradition of naming language versions b ...
and C++1y for
C++14 C++14 is a version of the ISO/IEC 14882 standard for the C++ programming language. It is intended to be a small extension over C++11, featuring mainly bug fixes and small improvements, and was replaced by C++17. Its approval was announced on Augus ...
. The C++17 specification reached the Draft International Standard (DIS) stage in March 2017. This DIS was unanimously approved, with only editorial comments, and the final standard was published in December 2017. Few changes were made to the C++
Standard Template Library The Standard Template Library (STL) is a Library (computer science), software library originally designed by Alexander Stepanov for the C++ programming language that influenced many parts of the C++ Standard Library. It provides four components ...
, although some
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algorithms are used as specificat ...
s in the header were given support for explicit
parallelization Parallel computing is a type of computation in which many calculations or processes are carried out simultaneously. Large problems can often be divided into smaller ones, which can then be solved at the same time. There are several different fo ...
and some
syntactic In linguistics, syntax () is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituency), ...
enhancements were made.


New features

C++17 introduced many new features. The following lists may be incomplete.


Language

* Making the text message for optional * Allow (as an alternative to ) in a template template parameter * New rules for deduction from braced-init-list * Nested namespace definitions, e.g., instead of * Allowing attributes for
namespace In computing, a namespace is a set of signs (''names'') that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified. Namespaces ...
s and enumerators * New standard attributes , and *
UTF-8 UTF-8 is a variable-width encoding, variable-length character encoding used for electronic communication. Defined by the Unicode Standard, the name is derived from ''Unicode'' (or ''Universal Coded Character Set'') ''Transformation Format 8-bit'' ...
() character literals (UTF-8 string literals have existed since
C++11 C++11 is a version of the ISO/ IEC 14882 standard for the C++ programming language. C++11 replaced the prior version of the C++ standard, called C++03, and was later replaced by C++14. The name follows the tradition of naming language versions b ...
; 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 The C0 and C1 control code or control character sets define control codes for use in text by computer systems that use ASCII and derivatives of ASCII. The codes represent additional information about the text, such as the position of a cursor, ...
, i.e.
ASCII ASCII ( ), abbreviated from American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices. Because of ...
) * Hexadecimal
floating-point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can b ...
literals * Use of as the type for a non-type template parameter * Constant evaluation for all non-type template arguments * Fold expressions, for
variadic template In computer programming, variadic templates are templates that take a variable number of arguments. Variadic templates are supported by C++ (since the C++11 standard), and the D programming language. C++ The variadic template feature of C++ was d ...
s * A compile-time static with the form * Structured binding declarations, allowing * Initializers in and statements * copy-initialization and direct-initialization of objects of type from prvalue expressions of type (ignoring top-level cv-qualifiers) shall result in no copy or move constructors from the prvalue expression. See copy elision for more information. * Some extensions on over-aligned memory allocation * Class template argument deduction (CTAD), introducing constructor deduction guides, e.g. allowing instead of requiring explicit constructor arguments types or an additional helper template function . * Inline variables, which allows the definition of variables in header files without violating the
one definition rule The One Definition Rule (ODR) is an important rule of the C++ programming language that prescribes that classes/structs and non-inline functions cannot have more than one definition in the entire program and template and types cannot have more than ...
. The rules are effectively the same as
inline function In the C and C++ programming languages, an inline function is one qualified with the keyword inline; this serves two purposes: # It serves as a compiler directive that suggests (but does not require) that the compiler substitute the body of ...
s * , allowing the availability of a header to be checked by preprocessor directives * Value of changed to * Exception specifications were made part of the function type * Lambda expressions can capture "*this" by value


Library

* Most of Library Fundamentals TS I, including: **std::string_view, a read-only non-owning reference to a character sequence or string-slice ** std::optional, for representing optional objects, a data type that may not always be returned by a given algorithm with support for non-return ** std::any, for holding single values of any type * std::uncaught_exceptions, as a replacement of std::uncaught_exception in
exception handling In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
* New insertion functions try_emplace and insert_or_assign for std::map and std::unordered_map key-value associative data structures * Uniform
container A container is any receptacle or enclosure for holding a product used in storage, packaging, and transportation, including shipping. Things kept inside of a container are protected on several sides by being inside of its structure. The term ...
access: std::size, std::empty and std::data * Definition of "contiguous
iterator In computer programming, an iterator is an object that enables a programmer to traverse a container, particularly lists. Various types of iterators are often provided via a container's interface. Though the interface and semantics of a given iterat ...
s" * A
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one larg ...
library based on boost::filesystem *
Parallel Parallel is a geometric term of location which may refer to: Computing * Parallel algorithm * Parallel computing * Parallel metaheuristic * Parallel (software), a UNIX utility for running programs in parallel * Parallel Sysplex, a cluster of ...
versions of STL algorithms * Additional mathematical
special functions Special functions are particular mathematical functions that have more or less established names and notations due to their importance in mathematical analysis, functional analysis, geometry, physics, or other applications. The term is defined b ...
, including
elliptic integral In integral calculus, an elliptic integral is one of a number of related functions defined as the value of certain integrals, which were first studied by Giulio Fagnano and Leonhard Euler (). Their name originates from their originally arising in ...
s and
Bessel function Bessel functions, first defined by the mathematician Daniel Bernoulli and then generalized by Friedrich Bessel, are canonical solutions of Bessel's differential equation x^2 \frac + x \frac + \left(x^2 - \alpha^2 \right)y = 0 for an arbitrar ...
s * std::variant, a
tagged union In computer science, a tagged union, also called a variant, variant record, choice type, discriminated union, disjoint union, sum type or coproduct, is a data structure used to hold a value that could take on several different, but fixed, types. O ...
container * std::byte, allowing
char Char may refer to: People *Char Fontane, American actress *Char Margolis, American spiritualist * René Char (1907–1988), French poet *The Char family of Colombia: ** Fuad Char, Colombian senator ** Alejandro Char Chaljub, mayor of Barranquilla ...
to be replaced for data types intending to model a
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
of data as a byte rather than a character * Logical operator traits: std::conjunction, std::disjunction and std::negation * header, for polymorphic memory resources


Removed features

This revision of C++ not only added new features but also removed a few. * Trigraphs were removed. * Some deprecated types and functions were removed from the standard library, including std::auto_ptr, std::random_shuffle, and old function adaptors. These were superseded in C++11 by improved facilities such as std::unique_ptr, std::shuffle, std::bind, and lambdas. * The (formerly deprecated) use of the keyword as a storage class specifier was removed. This keyword is still
reserved Reserved is a Polish apparel retailer headquartered in Gdańsk, Pomerania, Poland. It was founded in 1999 and remains the largest company of the LPP group, which has more than 1,700 retail stores located in over 20 countries and also owns such ...
but now unused.


Compiler support

* GCC has had complete support for C++17 language features since version 8. *
Clang Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA, and HIP frameworks. It acts as a drop-in replacement for the GNU Compiler Collection ...
5 and later supports all C++17 language features. *
Visual Studio 2017 Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
15.8 (MSVC 19.15) and later supports all C++17 language features.


Library support

* libstdc++ since version 9.1 has complete support for C++17 (8.1 without Parallelism TS and referring to C99 instead of C11) * libc++ as of version 9 has partial support for C++17, with the remainder "in progress" *
Visual Studio 2017 Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including web site, websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platfor ...
15.8 (MSVC 19.15) Standard Library and later supports all C++17 library features except for "Elementary String Conversions" and referring to C99 instead of C11. "Elementary String Conversions" is added in
Visual Studio 2019 Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs including websites, web apps, web services and mobile apps. Visual Studio uses Microsoft software development platforms such ...
16.4


See also

*
C++ compilers C, or c, is the third letter in the Latin alphabet, used in the modern English alphabet, the alphabets of other western European languages and others worldwide. Its name in English is ''cee'' (pronounced ), plural ''cees''. History "C" ...
*
C11 (C standard revision) C11 (formerly C1X) is an informal name for ISO/IEC 9899:2011, a past standard for the C programming language. It replaced C99 (standard ISO/IEC 9899:1999) and has been superseded by C17 (standard ISO/IEC 9899:2018). C11 mainly standardizes fea ...
*
C17 (C standard revision) C17 is the informal name for ISO/IEC 9899:2018, the most recent standard for the C programming language, prepared in 2017 and published in June 2018. It replaced C11 (standard ISO/IEC 9899:2011). C17 will be superseded by C2x. Since it was un ...


References

{{ISO standards C++ C++ programming language family Programming language standards Articles with example C++ code IEC standards ISO standards