Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/language"

From cppreference.com
< cpp
m (See also: nomono)
m (Added (CTAD) acronym explicitly.)
 
(64 intermediate revisions by 22 users not shown)
Line 4: Line 4:
 
This is a reference of the core C++ language constructs.
 
This is a reference of the core C++ language constructs.
  
{| cellpadding="5"
+
{|cellpadding="5"
|- valign="top"
+
|-valign="top"
 
|
 
|
 
+
'''{{rl|basic concepts|Basic concepts}}'''
'''{{rl|basic_concepts|Basic concepts}}'''
+
 
<div class="mainpagediv">
 
<div class="mainpagediv">
 
{{rlp|comment|Comments}}<br>
 
{{rlp|comment|Comments}}<br>
 
{{rl|ascii|ASCII chart}}<br>
 
{{rl|ascii|ASCII chart}}<br>
 +
{{rl|punctuators|Punctuation}}<br>
 
{{rl|identifiers|Names and identifiers}}<br>
 
{{rl|identifiers|Names and identifiers}}<br>
 
{{rl|type|Types}} –  
 
{{rl|type|Types}} –  
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}}<br>
+
{{rl|ub|Undefined behavior (UB)}}<br>
{{rl|memory_model|Memory model and data races}}<br>
+
{{rl|memory model|Memory}} – {{rl|multithread|Multithread}} {{mark c++11}}<br>
{{rl|translation_phases|Phases of translation}}<br>
+
{{rl|charset|Character sets and encodings}}<br>
{{rl|main_function|The {{tt|main}} function}}<br>
+
{{rl|translation phases|Phases of translation}}<br>
 +
{{rl|main function|The {{tt|main}} function}}<br>
 
{{rl|modules|Modules}} {{mark c++20}}<br>
 
{{rl|modules|Modules}} {{mark c++20}}<br>
 
</div>
 
</div>
Line 31: Line 32:
 
'''{{rlp|keyword|Keywords}}'''
 
'''{{rlp|keyword|Keywords}}'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
<!-- -->
+
<!---->
 
</div>
 
</div>
  
 
'''{{rlp|preprocessor|Preprocessor}}'''
 
'''{{rlp|preprocessor|Preprocessor}}'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
{{rlp|preprocessor/conditional|#if #ifdef #else – #endif}}<br>
+
{{rlp|preprocessor/conditional|{{tt|#if}} - {{tt|#ifdef}} - {{tt|#ifndef}} - {{tt|#elif}}}}<br>
{{rlp|preprocessor/replace|#define # ##}}
+
{{rlp|preprocessor/conditional|{{tt|#elifdef}} - {{tt|#elifndef}}}} {{mark c++23}}<br>
{{rlp|preprocessor/include|#include}}<br>
+
{{rlp|preprocessor/replace|{{tt|#define}} - {{tt|#}} - {{tt|##}}}}<br>
{{rlp|preprocessor/error|#error}}
+
{{rlpt|preprocessor/include|#include}} -
{{rlp|preprocessor/impl|#pragma}}
+
{{rlpt|preprocessor/impl|#pragma}}<br>
{{rlp|preprocessor/line|#line}}<br>
+
{{rlpt|preprocessor/line|#line}} -
 +
{{rlpt|preprocessor/error|#error}}<br>
 +
{{rlpt|preprocessor/error|#warning}} {{mark c++23}}<br>
 
</div>
 
</div>
  
 
'''{{rl|expressions|Expressions}}'''
 
'''{{rl|expressions|Expressions}}'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
{{rl|value_category|Value categories}}<br>
+
{{rl|value category|Value categories}}<br>
{{rl|eval_order|Evaluation order and sequencing}}<br>
+
{{rl|eval order|Evaluation order}}<br>
{{rl|constant_expression|Constant expressions}}<br>
+
{{rl|constant expression|Constant expressions}}<br>
{{rl|expressions#Operators|Operators}}<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 and indirection}}<br>
+
{{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>
{{rl|operators|Operator overloading}}<br>
+
{{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>
{{rl|expressions#Conversions|Conversions}}<br>
+
{{ls|cpp/language/expressions#Conversions}}<br>
&nbsp; {{rl|implicit_cast|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; {{rlt|static_cast}} – {{rlt|dynamic_cast}}<br>
+
{{nbsp|4}}{{rlt|static_cast}} – {{rlt|dynamic_cast}}<br>
&nbsp; {{rlt|const_cast}} {{rlt|reinterpret_cast}}<br>
+
{{nbsp|4}}{{rlt|const_cast}}<br>
{{rl|expressions#Literals|Literals}}<br>
+
{{nbsp|4}}{{rlt|reinterpret_cast}}<br>
&nbsp; {{rl|bool_literal|boolean}} –
+
{{ls|cpp/language/expressions#Literals}} ({{rl|escape|Escape sequences}})<br>
{{rl|integer_literal|integer}} –
+
{{nbsp|4}}{{rl|bool literal|boolean}} –
{{rl|floating_literal|floating}}<br>
+
{{rl|integer literal|integer}} –
&nbsp; {{rl|character_literal|character}} –
+
{{rl|floating literal|floating}}<br>
{{rl|string_literal|string}}<br>
+
{{nbsp|4}}{{rl|character literal|character}} –
&nbsp; {{rlt|nullptr}} {{mark c++11}}<br>
+
{{rl|string literal|string}}<br>
&nbsp; {{rl|user_literal|user-defined}} {{mark c++11}}<br>
+
{{nbsp|4}}{{rlt|nullptr}} {{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>
 
{{rl|reference|References}} –
 
{{rl|reference|References}} –
 
{{rl|pointer|Pointers}} –
 
{{rl|pointer|Pointers}} –
 
{{rl|array|Arrays}}<br>
 
{{rl|array|Arrays}}<br>
{{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|storage_duration|Storage duration and linkage}}<br>
 
{{rl|tu_local|Translation-unit-local}} {{mark c++20}}<br>
 
{{rl|language_linkage|Language linkage}}<br>
 
 
{{rl|inline|{{tt|inline}} specifier}}<br>
 
{{rl|inline|{{tt|inline}} specifier}}<br>
 
{{rl|asm|Inline assembly}}<br>
 
{{rl|asm|Inline assembly}}<br>
{{rl|cv|{{tt|const}}/{{tt|volatile}}}} {{rlt|constexpr}} {{mark c++11}}<br>
+
{{rl|cv|{{tt|const}}/{{tt|volatile}}}}<br>
{{rlt|consteval}} {{mark c++20}} {{rlt|constinit}} {{mark c++20}}<br>
+
{{rlt|constexpr}} {{mark c++11}}<br>
{{rlt|decltype}} {{mark c++11}} {{rlt|auto}} {{mark c++11}} <br>
+
{{rlt|consteval}} {{mark c++20}}<br>
{{rlt|typedef}} – {{rl|type_alias|Type alias}} {{mark c++11}}<br>
+
{{rlt|constinit}} {{mark c++20}}<br>
{{rl|elaborated_type_specifier|Elaborated type specifiers}}<br>
+
{{rlt|decltype}} {{mark c++11}}<br>
{{rl|attributes|Attributes}} {{mark c++11}} {{rlt|alignas}} {{mark c++11}}<br>
+
{{rlt|auto}} {{mark c++11}}<br>
 +
{{rlt|typedef}} – {{rl|type alias|Type alias}} {{mark c++11}}<br>
 +
{{rl|elaborated type specifier|Elaborated type specifiers}}<br>
 +
{{rl|attributes|Attributes}} {{mark c++11}}<br>
 +
{{rlt|alignas}} {{mark c++11}}<br>
 
{{rlt|static_assert}} {{mark c++11}}<br>
 
{{rlt|static_assert}} {{mark c++11}}<br>
 
</div>
 
</div>
Line 105: 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}} {{mark c++03}}<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}}
+
{{rl|copy elision|Copy elision (RVO)}}
 
</div>
 
</div>
  
Line 122: Line 129:
 
<div class="mainpagediv">
 
<div class="mainpagediv">
 
{{rl|function|Function declaration}}<br>
 
{{rl|function|Function declaration}}<br>
{{rl|default_arguments|Default arguments}}<br>
+
{{rl|default arguments|Default arguments}}<br>
{{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|adl|Argument-dependent lookup}}<br>
+
{{rl|overload resolution|Overload resolution}}<br>
{{rl|overload_resolution|Overload resolution}}<br>
+
 
{{rl|operators|Operator overloading}}<br>
 
{{rl|operators|Operator overloading}}<br>
{{rl|overloaded_address|Address of an overload set}}<br>
+
{{rl|overloaded address|Address of an overload set}}<br>
 
{{rl|coroutines|Coroutines}} {{mark c++20}}<br>
 
{{rl|coroutines|Coroutines}} {{mark c++20}}<br>
 
</div>
 
</div>
Line 140: 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}} and {{tt|atomic}}}} {{mark since tm ts}}<br>
+
{{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 153: Line 157:
 
{{rl|union|Union types}}<br>
 
{{rl|union|Union types}}<br>
 
{{rl|injected-class-name}}<br>
 
{{rl|injected-class-name}}<br>
{{rl|data_members|Data members}} –
+
{{rl|data members|Data members}} –
{{rl|bit_field|Bit fields}}<br>
+
{{rl|bit field|Bit-fields}}<br>
{{rl|member_functions|Member functions}} –
+
{{rl|member functions|Member functions}} –
{{rl|this|The {{tt|this}} pointer}} <br>
+
{{rl|this|The {{tt|this}} pointer}}<br>
 
{{rl|static|Static members}} –
 
{{rl|static|Static members}} –
{{rl|nested_types|Nested classes}}<br>
+
{{rl|nested types|Nested classes}}<br>
{{rl|derived_class|Derived class}} –
+
{{rl|derived class|Derived class}} –
{{rl|using_declaration|{{tt|using}}-declaration}}<br>
+
{{rl|using declaration|{{tt|using}}-declaration}}<br>
{{rl|ebo|Empty base optimization}}<br>
+
{{rl|ebo|Empty base optimization (EBO)}}<br>
 
{{rl|virtual|Virtual function}} –
 
{{rl|virtual|Virtual function}} –
{{rl|abstract_class|Abstract class}}<br>
+
{{rl|abstract class|Abstract class (ABC)}}<br>
 
{{rlt|override}} {{mark c++11}} – {{rlt|final}} {{mark c++11}}<br>
 
{{rlt|override}} {{mark c++11}} – {{rlt|final}} {{mark c++11}}<br>
 
{{rl|access|Member access}} –
 
{{rl|access|Member access}} –
{{rlt|friend}} <br>  
+
{{rlt|friend}}<br>  
 
{{rl|constructor|Constructors and member initializer lists}}<br>
 
{{rl|constructor|Constructors and member initializer lists}}<br>
{{rl|default_constructor|Default constructor}} –
+
{{rl|default constructor|Default constructor}} –
 
{{rl|destructor|Destructor}}<br>
 
{{rl|destructor|Destructor}}<br>
{{rl|copy_constructor|Copy constructor}} –
+
{{rl|copy constructor|Copy constructor}} –
{{rl|copy_assignment|Copy assignment}} <br>
+
{{rl|copy assignment|Copy assignment}}<br>
{{rl|move_constructor|Move constructor}} {{mark c++11}}<br>
+
{{rl|move constructor|Move constructor}} {{mark c++11}}<br>
{{rl|move_assignment|Move assignment}} {{mark c++11}}<br>
+
{{rl|move assignment|Move assignment}} {{mark c++11}}<br>
{{rl|converting_constructor|Converting constructor}}
+
{{rl|converting constructor|Converting constructor}}<br>
 
{{rl|explicit|{{tt|explicit}} specifier}}<br>
 
{{rl|explicit|{{tt|explicit}} specifier}}<br>
 
</div>
 
</div>
Line 180: Line 184:
 
'''{{rl|templates|Templates}}'''
 
'''{{rl|templates|Templates}}'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
{{rl|template_parameters|Template parameters and arguments}}<br>
+
{{rl|template parameters|Template parameters and arguments}}<br>
{{rl|class_template|Class template}} –
+
{{rl|class template|Class template}} –
{{rl|function_template|Function template}}<br>
+
{{rl|function template|Function template}}<br>
{{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>
+
'''Template argument deduction'''<br>
{{rl|class template argument deduction|Class template argument deduction}} {{mark c++17}}<br>
+
{{nbsp|4}}{{rl|template argument deduction|function}} –
{{rl|template_specialization|Explicit specialization}} – {{rl|partial_specialization|Partial specialization}}<br>
+
{{rl|class template argument deduction|class (CTAD)}} {{mark c++17}}<br>
{{rl|parameter_pack|Parameter packs}} {{mark c++11}}
+
{{rl|template specialization|Explicit specialization}} – {{rl|partial specialization|Partial specialization}}<br>
 +
{{rl|parameter pack|Parameter packs}} {{mark c++11}}<br>
 
{{rlt|sizeof...}} {{mark c++11}}<br>
 
{{rlt|sizeof...}} {{mark c++11}}<br>
{{rl|fold|Fold-expressions}} {{mark c++17}}<br>
+
{{rl|fold|Fold expressions}} {{mark c++17}}<br>
{{rl|dependent_name|Dependent names}} –
+
{{rl|pack_indexing|Pack indexing}} {{mark c++26}}<br>
 +
{{rl|dependent name|Dependent names}} –
 
{{rl|sfinae|SFINAE}}<br>
 
{{rl|sfinae|SFINAE}}<br>
 
{{rl|constraints|Constraints and concepts}} {{mark c++20}}<br>
 
{{rl|constraints|Constraints and concepts}} {{mark c++20}}<br>
 +
{{rl|requires|Requires expression}} {{mark c++20}}<br>
 
</div>
 
</div>
  
 
'''{{rl|exceptions|Exceptions}}'''
 
'''{{rl|exceptions|Exceptions}}'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
{{rl|throw|{{tt|throw}}-expression}}<br>
+
{{rl|try|{{tt|try}} block}}<br>
{{rl|try_catch|{{tt|try}}-{{tt|catch}} block}}<br>
+
{{rl|throw|Throwing exceptions}}<br>
{{rl|function-try-block|function-{{tt|try}}-block}}<br>
+
{{rl|catch|Handling exceptions}}<br>
{{rl|noexcept_spec|{{tt|noexcept}} specifier}} {{mark c++11}}<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>
{{rl|except_spec|Dynamic exception specification}} {{mark until c++17}}<br>
 
 
</div>
 
</div>
  
Line 209: Line 217:
 
<div class="mainpagediv">
 
<div class="mainpagediv">
 
{{rl|history|History of C++}}<br>
 
{{rl|history|History of C++}}<br>
{{rl|extending_std|Extending the namespace std}}<br>
+
{{rl|extending std|Extending the namespace std}}<br>
{{rl|acronyms|Acronyms}}
+
{{rl|acronyms|Acronyms}}:
 +
[[cpp/ranges/cpo|CPO]],
 +
[[cpp/language/ndr|IFNDR]],
 +
[[cpp/language/ndr|NDR]],
 +
[[cpp/string/byte|NTBS]],<br>
 +
[[cpp/language/template parameters#Non-type template parameter|NTTP]],
 +
[[cpp/ranges#Range adaptor objects|RAO]],
 +
[[cpp/memory/allocator_traits/select_on_container_copy_construction|SOCCC]],
 +
[[cpp/language/template metaprogramming|TMP]],
 +
[[cpp/language/translation phases#Phase 8|TU]]
 
</div>
 
</div>
  
 
'''Idioms'''
 
'''Idioms'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
{{rl|raii|Resource acquisition is initialization}}<br>
+
{{rl|crtp|Curiously Recurring Template Pattern (CRTP)}}<br>
{{rl|rule_of_three|Rule of three/five/zero}}<br>
+
{{rl|pimpl|Pointer to implementation (PIMPL)}}<br>
{{rl|pimpl|Pointer to implementation}}<br>
+
{{rl|raii|Resource acquisition is initialization (RAII)}}<br>
{{rl|Zero-overhead_principle|Zero-overhead principle}}<br>
+
{{rl|rule of three|Rule of three/five/zero}}<br>
 +
{{rl|Zero-overhead principle|Zero-overhead principle}}<br>
 
</div>
 
</div>
 
|}
 
|}
Line 224: Line 242:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc see c | c/language |C language constructs | nomono=true}}
+
{{dsc see c|c/language|C language constructs|nomono=true}}
 
{{dsc end}}
 
{{dsc end}}
  
 
{{langlinks|ar|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}
 
{{langlinks|ar|de|es|fr|it|ja|ko|pl|pt|ru|tr|zh}}

Latest revision as of 11:11, 21 September 2024

 
 
C++ language
General topics
Flow control
Conditional execution statements
if
Iteration statements (loops)
for
range-for (C++11)
Jump statements
Functions
Function declaration
Lambda function expression
inline specifier
Dynamic exception specifications (until C++17*)
noexcept specifier (C++11)
Exceptions
Namespaces
Types
Specifiers
const/volatile
decltype (C++11)
auto (C++11)
constexpr (C++11)
consteval (C++20)
constinit (C++20)
Storage duration specifiers
Initialization
Expressions
Alternative representations
Literals
Boolean - Integer - Floating-point
Character - String - nullptr (C++11)
User-defined (C++11)
Utilities
Attributes (C++11)
Types
typedef declaration
Type alias declaration (C++11)
Casts
Memory allocation
Classes
Class-specific function properties
explicit (C++11)
static

Special member functions
Templates
Miscellaneous
 

This is a reference of the core C++ language constructs.

Basic concepts

Keywords

Preprocessor

Expressions

Declarations

Initialization

Functions

Statements

Classes

Templates

Exceptions

try block
Throwing exceptions
Handling exceptions
Exception specification
    noexcept specification (C++11)
    Dynamic specification (until C++17*)
noexcept operator (C++11)

Miscellaneous

Idioms

[edit] See also

C documentation for C language constructs