Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/language"

From cppreference.com
< cpp
m
m (add more acronyms as many know them.)
Line 21: Line 21:
 
{{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}} {{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}}<br>
Line 38: Line 38:
 
'''{{rlp|preprocessor|Preprocessor}}'''
 
'''{{rlp|preprocessor|Preprocessor}}'''
 
<div class="mainpagediv">
 
<div class="mainpagediv">
{{rlp|preprocessor/conditional | {{tt|#if}} - {{tt|#ifdef}} - {{tt|#ifndef}} - {{tt|#elif}}}}<br>
+
{{rlp|preprocessor/conditional|{{tt|#if}} - {{tt|#ifdef}} - {{tt|#ifndef}} - {{tt|#elif}}}}<br>
{{rlp|preprocessor/conditional | {{tt|#elifdef}} - {{tt|#elifndef}}}} {{mark c++23}}<br>
+
{{rlp|preprocessor/conditional|{{tt|#elifdef}} - {{tt|#elifndef}}}} {{mark c++23}}<br>
{{rlp|preprocessor/replace | {{tt|#define}} - {{tt|#}} - {{tt|##}}}}<br>  
+
{{rlp|preprocessor/replace|{{tt|#define}} - {{tt|#}} - {{tt|##}}}}<br>  
{{rlpt|preprocessor/include |#include}} -
+
{{rlpt|preprocessor/include|#include}} -
{{rlpt|preprocessor/impl |#pragma}}<br>
+
{{rlpt|preprocessor/impl|#pragma}}<br>
{{rlpt|preprocessor/line |#line}} -
+
{{rlpt|preprocessor/line|#line}} -
{{rlp|preprocessor/error | {{tt|#error}} - {{tt|#warning}}}} {{mark c++23}}<br>
+
{{rlp|preprocessor/error|{{tt|#error}} - {{tt|#warning}}}} {{mark c++23}}<br>
 
</div>
 
</div>
  
Line 53: Line 53:
 
{{rl|constant expression|Constant expressions}}<br>
 
{{rl|constant expression|Constant expressions}}<br>
 
{{rl|expressions#Operators|Operators}}<br>
 
{{rl|expressions#Operators|Operators}}<br>
&nbsp; {{rl|operator assignment|assignment}} –
+
{{nbsp}} {{rl|operator assignment|assignment}} –
 
{{rl|operator arithmetic|arithmetic}}<br>
 
{{rl|operator arithmetic|arithmetic}}<br>
&nbsp; {{rl|operator incdec|increment and decrement}}<br>
+
{{nbsp}} {{rl|operator incdec|increment and decrement}}<br>
&nbsp; {{rl|operator logical|logical}} –
+
{{nbsp}} {{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}} {{rl|operator member access|member access and indirection}}<br>
&nbsp; {{rl|operator other|call, comma, ternary}}<br>
+
{{nbsp}} {{rl|operator other|call, comma, ternary}}<br>
&nbsp; {{rlt|sizeof}} – {{rlt|alignof}} {{mark c++11}}<br>
+
{{nbsp}} {{rlt|sizeof}} – {{rlt|alignof}} {{mark c++11}}<br>
&nbsp; {{rlt|new}} – {{rlt|delete}} – {{rlt|typeid}}<br>
+
{{nbsp}} {{rlt|new}} – {{rlt|delete}} – {{rlt|typeid}}<br>
&nbsp; {{rl|operator_alternative|alternative representation}}<br>
+
{{nbsp}} {{rl|operator_alternative|alternative representation}}<br>
 
{{rl|operators|Operator overloading}}<br>
 
{{rl|operators|Operator overloading}}<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>
 
{{rl|expressions#Conversions|Conversions}}<br>
&nbsp; {{rl|implicit conversion|implicit}} –
+
{{nbsp}} {{rl|implicit conversion|implicit}} –
 
{{rl|explicit cast|explicit}} –
 
{{rl|explicit cast|explicit}} –
 
{{rl|cast operator|user-defined}}<br>
 
{{rl|cast operator|user-defined}}<br>
&nbsp; {{rl|usual arithmetic conversions|Usual arithmetic conversions}}<br>
+
{{nbsp}} {{rl|usual arithmetic conversions|Usual arithmetic conversions}}<br>
&nbsp; {{rlt|static_cast}} – {{rlt|dynamic_cast}}<br>
+
{{nbsp}} {{rlt|static_cast}} – {{rlt|dynamic_cast}}<br>
&nbsp; {{rlt|const_cast}} – {{rlt|reinterpret_cast}}<br>
+
{{nbsp}} {{rlt|const_cast}} – {{rlt|reinterpret_cast}}<br>
 
{{rl|expressions#Literals|Literals}} ({{rl|escape|Escape sequences}})<br>
 
{{rl|expressions#Literals|Literals}} ({{rl|escape|Escape sequences}})<br>
&nbsp; {{rl|bool literal|boolean}} –
+
{{nbsp}} {{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}} {{rl|character literal|character}} –
 
{{rl|string literal|string}}<br>
 
{{rl|string literal|string}}<br>
&nbsp; {{rlt|nullptr}} {{mark c++11}}<br>
+
{{nbsp}} {{rlt|nullptr}} {{mark c++11}}<br>
&nbsp; {{rl|user literal|user-defined}} {{mark c++11}}<br>
+
{{nbsp}} {{rl|user literal|user-defined (UDL)}} {{mark c++11}}<br>
 
</div>
 
</div>
  
Line 121: Line 121:
 
{{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}}{{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}}{{rl|initialization#Non-local variables|ordered}} – {{rl|initialization#Non-local variables|unordered}}<br>
 
{{rl|copy elision|Copy elision}}
 
{{rl|copy elision|Copy elision}}
 
</div>
 
</div>
Line 164: Line 164:
 
{{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>
Line 194: Line 194:
 
{{rl|member template|Class member template}}<br>
 
{{rl|member template|Class member template}}<br>
 
{{rl|template argument deduction|Template argument deduction}}<br>
 
{{rl|template argument deduction|Template argument deduction}}<br>
{{rl|class template argument deduction|Class template argument deduction}} {{mark c++17}}<br>
+
{{rl|class template argument deduction|Class template argument deduction (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}} –
Line 219: Line 219:
 
{{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|NTTP]],
 +
[[cpp/ranges#Range adaptor objects|RAO]],
 +
[[cpp/language/copy elision|RVO]],
 +
[[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|raii|Resource acquisition is initialization (RAII)}}<br>
 
{{rl|rule of three|Rule of three/five/zero}}<br>
 
{{rl|rule of three|Rule of three/five/zero}}<br>
{{rl|pimpl|Pointer to implementation}}<br>
+
{{rl|pimpl|Pointer to implementation (PIMPL)}}<br>
 
{{rl|Zero-overhead principle|Zero-overhead principle}}<br>
 
{{rl|Zero-overhead principle|Zero-overhead principle}}<br>
{{rl|crtp|Curiously Recurring Template Pattern}}<br>
+
{{rl|crtp|Curiously Recurring Template Pattern (CRTP)}}<br>
 
</div>
 
</div>
 
|}
 
|}

Revision as of 13:08, 14 June 2023

 
 
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

Miscellaneous

Idioms

See also

C documentation for C language constructs