Difference between revisions of "cpp/language"
From cppreference.com
< cpp
m (Added (CTAD) acronym explicitly.) |
|||
(24 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{title|C++ language}} | ||
+ | {{cpp/language/navbar}} | ||
+ | This is a reference of the core C++ language constructs. | ||
− | + | {|cellpadding="5" | |
− | + | |-valign="top" | |
− | {| cellpadding="5" | + | |
− | |- valign="top" | + | |
| | | | ||
− | |||
'''{{rl|basic concepts|Basic concepts}}''' | '''{{rl|basic concepts|Basic concepts}}''' | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
Line 20: | Line 20: | ||
{{rl|definition|Definitions and ODR}}<br> | {{rl|definition|Definitions and ODR}}<br> | ||
{{rl|lookup|Name lookup}}<br> | {{rl|lookup|Name lookup}}<br> | ||
− | {{nbsp}} {{rl|qualified lookup|qualified}} – {{rl|unqualified lookup|unqualified}} ({{rl|adl|ADL}})<br> | + | {{nbsp|4}}{{rl|qualified lookup|qualified}} – {{rl|unqualified lookup|unqualified}} ({{rl|adl|ADL}})<br> |
{{rl|as if|As-if rule}}<br> | {{rl|as if|As-if rule}}<br> | ||
{{rl|ub|Undefined behavior (UB)}}<br> | {{rl|ub|Undefined behavior (UB)}}<br> | ||
− | {{rl|memory model|Memory | + | {{rl|memory model|Memory}} – {{rl|multithread|Multithread}} {{mark c++11}}<br> |
{{rl|charset|Character sets and encodings}}<br> | {{rl|charset|Character sets and encodings}}<br> | ||
{{rl|translation phases|Phases of translation}}<br> | {{rl|translation phases|Phases of translation}}<br> | ||
Line 32: | Line 32: | ||
'''{{rlp|keyword|Keywords}}''' | '''{{rlp|keyword|Keywords}}''' | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
− | <!-- | + | <!----> |
</div> | </div> | ||
Line 43: | Line 43: | ||
{{rlpt|preprocessor/impl|#pragma}}<br> | {{rlpt|preprocessor/impl|#pragma}}<br> | ||
{{rlpt|preprocessor/line|#line}} - | {{rlpt|preprocessor/line|#line}} - | ||
− | {{ | + | {{rlpt|preprocessor/error|#error}}<br> |
+ | {{rlpt|preprocessor/error|#warning}} {{mark c++23}}<br> | ||
</div> | </div> | ||
Line 49: | Line 50: | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
{{rl|value category|Value categories}}<br> | {{rl|value category|Value categories}}<br> | ||
− | {{rl|eval order|Evaluation order | + | {{rl|eval order|Evaluation order}}<br> |
{{rl|constant expression|Constant expressions}}<br> | {{rl|constant expression|Constant expressions}}<br> | ||
− | {{ | + | {{ls|cpp/language/expressions#Operators}}<br> |
− | {{nbsp}} {{rl|operator assignment|assignment}} – | + | {{nbsp|4}}{{rl|operator assignment|assignment}} – |
{{rl|operator arithmetic|arithmetic}}<br> | {{rl|operator arithmetic|arithmetic}}<br> | ||
− | {{nbsp}} {{rl|operator incdec|increment and decrement}}<br> | + | {{nbsp|4}}{{rl|operator incdec|increment and decrement}}<br> |
− | {{nbsp}} {{rl|operator logical|logical}} – | + | {{nbsp|4}}{{rl|operator logical|logical}} – |
{{rl|operator comparison|comparison}}<br> | {{rl|operator comparison|comparison}}<br> | ||
− | {{nbsp}} {{rl|operator member access|member access | + | {{nbsp|4}}{{rl|operator member access|member access}}<br> |
− | {{nbsp}} {{rl|operator other|call, comma, ternary}}<br> | + | {{nbsp|4}}{{rl|operator other|call, comma, ternary}}<br> |
− | {{nbsp}} {{rlt|sizeof}} – {{rlt|alignof}} {{mark c++11}}<br> | + | {{nbsp|4}}{{rlt|sizeof}} – {{rlt|alignof}} {{mark c++11}}<br> |
− | {{nbsp}} {{rlt|new}} – {{rlt|delete}} – {{rlt|typeid}}<br> | + | {{nbsp|4}}{{rlt|new}} – {{rlt|delete}} – {{rlt|typeid}}<br> |
− | {{nbsp}} {{rl|operator_alternative|alternative representation | + | {{nbsp|4}}{{rl|operator_alternative|alternative representation}}<br> |
− | + | ||
{{rl|default comparisons|Default comparisons}} {{mark c++20}}<br> | {{rl|default comparisons|Default comparisons}} {{mark c++20}}<br> | ||
{{rl|operator precedence|Operator precedence}}<br> | {{rl|operator precedence|Operator precedence}}<br> | ||
− | {{ | + | {{ls|cpp/language/expressions#Conversions}}<br> |
− | {{nbsp}} {{rl|implicit conversion|implicit}} – | + | {{nbsp|4}}{{rl|implicit conversion|implicit}} – {{rl|explicit cast|explicit}}<br> |
− | {{rl|explicit cast|explicit}} | + | {{nbsp|4}}{{rl|cast operator|user-defined}}<br> |
− | {{rl|cast operator|user-defined}}<br> | + | {{nbsp|4}}{{rl|usual arithmetic conversions|Usual arithmetic conversions}}<br> |
− | {{nbsp}} {{rl|usual arithmetic conversions|Usual arithmetic conversions}}<br> | + | {{nbsp|4}}{{rlt|static_cast}} – {{rlt|dynamic_cast}}<br> |
− | {{nbsp}} {{rlt|static_cast}} – {{rlt|dynamic_cast}}<br> | + | {{nbsp|4}}{{rlt|const_cast}}<br> |
− | {{nbsp}} {{rlt|const_cast}} | + | {{nbsp|4}}{{rlt|reinterpret_cast}}<br> |
− | {{ | + | {{ls|cpp/language/expressions#Literals}} ({{rl|escape|Escape sequences}})<br> |
− | {{nbsp}} {{rl|bool literal|boolean}} – | + | {{nbsp|4}}{{rl|bool literal|boolean}} – |
{{rl|integer literal|integer}} – | {{rl|integer literal|integer}} – | ||
{{rl|floating literal|floating}}<br> | {{rl|floating literal|floating}}<br> | ||
− | {{nbsp}} {{rl|character literal|character}} – | + | {{nbsp|4}}{{rl|character literal|character}} – |
{{rl|string literal|string}}<br> | {{rl|string literal|string}}<br> | ||
− | {{nbsp}} {{rlt|nullptr}} {{mark c++11}}<br> | + | {{nbsp|4}}{{rlt|nullptr}} {{mark c++11}}<br> |
− | {{nbsp}} {{rl|user literal|user-defined (UDL)}} {{mark c++11}}<br> | + | {{nbsp|4}}{{rl|user literal|user-defined (UDL)}} {{mark c++11}}<br> |
</div> | </div> | ||
− | |||
| | | | ||
− | |||
'''{{rl|declarations|Declarations}}''' | '''{{rl|declarations|Declarations}}''' | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
+ | {{rl|conflicting declarations|Conflicting declarations}}<br> | ||
+ | {{rl|storage duration|Storage duration and linkage}}<br> | ||
+ | {{rl|tu local|Translation-unit-local}} {{mark c++20}}<br> | ||
+ | {{rl|language linkage|Language linkage}}<br> | ||
{{rl|namespace|Namespace declaration}}<br> | {{rl|namespace|Namespace declaration}}<br> | ||
{{rl|namespace alias|Namespace alias}}<br> | {{rl|namespace alias|Namespace alias}}<br> | ||
Line 93: | Line 95: | ||
{{rl|structured binding|Structured bindings}} {{mark c++17}}<br> | {{rl|structured binding|Structured bindings}} {{mark c++17}}<br> | ||
{{rl|enum|Enumerations and enumerators}}<br> | {{rl|enum|Enumerations and enumerators}}<br> | ||
− | |||
− | |||
− | |||
{{rl|inline|{{tt|inline}} specifier}}<br> | {{rl|inline|{{tt|inline}} specifier}}<br> | ||
{{rl|asm|Inline assembly}}<br> | {{rl|asm|Inline assembly}}<br> | ||
Line 102: | Line 101: | ||
{{rlt|consteval}} {{mark c++20}}<br> | {{rlt|consteval}} {{mark c++20}}<br> | ||
{{rlt|constinit}} {{mark c++20}}<br> | {{rlt|constinit}} {{mark c++20}}<br> | ||
− | {{rlt|decltype}} {{mark c++11}} | + | {{rlt|decltype}} {{mark c++11}}<br> |
+ | {{rlt|auto}} {{mark c++11}}<br> | ||
{{rlt|typedef}} – {{rl|type alias|Type alias}} {{mark c++11}}<br> | {{rlt|typedef}} – {{rl|type alias|Type alias}} {{mark c++11}}<br> | ||
{{rl|elaborated type specifier|Elaborated type specifiers}}<br> | {{rl|elaborated type specifier|Elaborated type specifiers}}<br> | ||
Line 112: | Line 112: | ||
'''{{rl|initialization|Initialization}}''' | '''{{rl|initialization|Initialization}}''' | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
− | {{rl|default initialization|Default initialization}}<br> | + | {{rl|default initialization|Default-initialization}}<br> |
− | {{rl|value initialization|Value initialization}}<br> | + | {{rl|value initialization|Value-initialization}}<br> |
− | {{rl|copy initialization|Copy initialization}}<br> | + | {{rl|copy initialization|Copy-initialization}}<br> |
− | {{rl|direct initialization|Direct initialization}}<br> | + | {{rl|direct initialization|Direct-initialization}}<br> |
{{rl|aggregate initialization|Aggregate initialization}}<br> | {{rl|aggregate initialization|Aggregate initialization}}<br> | ||
− | {{rl|list initialization|List initialization}} {{mark c++11}}<br> | + | {{rl|list initialization|List-initialization}} {{mark c++11}}<br> |
{{rl|reference initialization|Reference initialization}}<br> | {{rl|reference initialization|Reference initialization}}<br> | ||
{{rl|initialization#Non-local variables|Static non-local initialization}}<br> | {{rl|initialization#Non-local variables|Static non-local initialization}}<br> | ||
− | {{nbsp}}{{rl|zero initialization|zero}} – {{rl|constant initialization|constant}}<br> | + | {{nbsp|4}}{{rl|zero initialization|zero}} – {{rl|constant initialization|constant}}<br> |
{{rl|initialization#Non-local variables|Dynamic non-local initialization}}<br> | {{rl|initialization#Non-local variables|Dynamic non-local initialization}}<br> | ||
− | {{nbsp}}{{rl|initialization#Non-local variables|ordered}} – {{rl|initialization#Non-local variables|unordered}}<br> | + | {{nbsp|4}}{{rl|initialization#Non-local variables|ordered}} – {{rl|initialization#Non-local variables|unordered}}<br> |
{{rl|copy elision|Copy elision (RVO)}} | {{rl|copy elision|Copy elision (RVO)}} | ||
</div> | </div> | ||
Line 132: | Line 132: | ||
{{rl|variadic arguments|Variadic arguments}}<br> | {{rl|variadic arguments|Variadic arguments}}<br> | ||
{{rl|lambda|Lambda expression}} {{mark c++11}}<br> | {{rl|lambda|Lambda expression}} {{mark c++11}}<br> | ||
− | |||
{{rl|overload resolution|Overload resolution}}<br> | {{rl|overload resolution|Overload resolution}}<br> | ||
{{rl|operators|Operator overloading}}<br> | {{rl|operators|Operator overloading}}<br> | ||
Line 147: | Line 146: | ||
{{rlt|while}} – {{rl|do|{{tt|do}}-{{tt|while}}}}<br> | {{rlt|while}} – {{rl|do|{{tt|do}}-{{tt|while}}}}<br> | ||
{{rlt|continue}} – | {{rlt|continue}} – | ||
− | {{rlt|break}} | + | {{rlt|break}}<br> |
{{rlt|goto}} – | {{rlt|goto}} – | ||
{{rlt|return}}<br> | {{rlt|return}}<br> | ||
− | {{rl|transactional memory|{{tt|synchronized}} | + | {{rl|transactional memory|{{tt|synchronized}}/{{tt|atomic}}}} {{mark since tm ts}}<br> |
</div> | </div> | ||
− | |||
| | | | ||
− | |||
'''{{rl|classes|Classes}}''' | '''{{rl|classes|Classes}}''' | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
Line 192: | Line 189: | ||
{{rl|variable template|Variable template}} {{mark c++14}}<br> | {{rl|variable template|Variable template}} {{mark c++14}}<br> | ||
{{rl|member template|Class member template}}<br> | {{rl|member template|Class member template}}<br> | ||
− | {{rl|template argument deduction| | + | '''Template argument deduction'''<br> |
− | {{rl|class template argument deduction| | + | {{nbsp|4}}{{rl|template argument deduction|function}} – |
+ | {{rl|class template argument deduction|class (CTAD)}} {{mark c++17}}<br> | ||
{{rl|template specialization|Explicit specialization}} – {{rl|partial specialization|Partial specialization}}<br> | {{rl|template specialization|Explicit specialization}} – {{rl|partial specialization|Partial specialization}}<br> | ||
− | {{rl|parameter pack|Parameter packs}} {{mark c++11}} | + | {{rl|parameter pack|Parameter packs}} {{mark c++11}}<br> |
{{rlt|sizeof...}} {{mark c++11}}<br> | {{rlt|sizeof...}} {{mark c++11}}<br> | ||
− | {{rl|fold|Fold | + | {{rl|fold|Fold expressions}} {{mark c++17}}<br> |
+ | {{rl|pack_indexing|Pack indexing}} {{mark c++26}}<br> | ||
{{rl|dependent name|Dependent names}} – | {{rl|dependent name|Dependent names}} – | ||
{{rl|sfinae|SFINAE}}<br> | {{rl|sfinae|SFINAE}}<br> | ||
Line 206: | Line 205: | ||
'''{{rl|exceptions|Exceptions}}''' | '''{{rl|exceptions|Exceptions}}''' | ||
<div class="mainpagediv"> | <div class="mainpagediv"> | ||
− | {{rl| | + | {{rl|try|{{tt|try}} block}}<br> |
− | {{rl| | + | {{rl|throw|Throwing exceptions}}<br> |
− | {{rl| | + | {{rl|catch|Handling exceptions}}<br> |
− | {{ | + | '''Exception specification'''<br> |
+ | {{nbsp|4}}{{rl|noexcept spec|{{tt|noexcept}} specification}} {{mark c++11}}<br> | ||
+ | {{nbsp|4}}{{rl|except spec|Dynamic specification}} {{mark tooltip|until C++17|deprecated in C++11}}<br> | ||
{{rl|noexcept|{{tt|noexcept}} operator}} {{mark c++11}}<br> | {{rl|noexcept|{{tt|noexcept}} operator}} {{mark c++11}}<br> | ||
− | |||
</div> | </div> | ||
Line 223: | Line 223: | ||
[[cpp/language/ndr|NDR]], | [[cpp/language/ndr|NDR]], | ||
[[cpp/string/byte|NTBS]],<br> | [[cpp/string/byte|NTBS]],<br> | ||
− | [[cpp/language/ | + | [[cpp/language/template parameters#Non-type template parameter|NTTP]], |
[[cpp/ranges#Range adaptor objects|RAO]], | [[cpp/ranges#Range adaptor objects|RAO]], | ||
[[cpp/memory/allocator_traits/select_on_container_copy_construction|SOCCC]], | [[cpp/memory/allocator_traits/select_on_container_copy_construction|SOCCC]], |
Latest revision as of 11:11, 21 September 2024
This is a reference of the core C++ language constructs.
[edit] See also
C documentation for C language constructs
|