[C++11] Curly braces {}, initializer_list, auto, decltype

Article directory 1. Expansion of curly braces { } 2.initializer_list 3.auto 4.decltype 5. Addition of containers 5.1array[useless] 5.2forward_list[useless] 5.3unordered_map/unordered_set 5.4 Unified increase 6. Zhihu articles 1. Expansion of curly braces { } int main() {<!– –> //C++98 curly braces {} support 1. Array 2. Structure struct Point {<!– –> int _x; int _y; }; int […]

C++ – C++11 history – unified list initialization – aotu – decltype – nullptr – STL changes after C++11

Table of Contents Understanding the development history of C++ Unified list initialization {}initialization std::initializer_list Add initializer_list as a parameter to the constructor in the simulated implementation of vector statement aotu decltype nullptr Some changes in STL after C++11 new container Some new methods in containers Understanding the development history of C++ In 2003, the C++ […]

[C++] C++11–List initialization and decltype

Unified list initialization { } initialization initializer_list container auto typeid(variable name).name() decltype Uniform list initialization Note that list initialization and initialization list here are two properties. {}Initialization In C++ 98, our curly braces only allowed for uniform list initialization of array or structure elements. For example //Structure struct Point {<!– –> int _x; int _y; […]

[C++11]{}Initialization, std::initializer_list, decltype, STL new containers

Article directory 1. Introduction to C++11 2. Unified list initialization 2.1 {}Initialization 2.2 std::initializer_list 3. Statement 3.1auto 3.2 decltype 4.nullptr 5. Range for loop 6. Smart pointers 7. Some changes in C++11STL 8. Demo code 1. Introduction to C++11 In 2003, the C++ Standards Committee submitted a technical errata (TC1 for short), which made the […]

[C++11] List initialization | decltype operator | nullptr | STL update

Article directory 1. List initialization 1. Brace initialization 2. initializer_list Two.decltype Three.nullptr Four. STL update 1. STL new container 2. String conversion function 3. Some new methods in the container 1. List initialization 1. Curly brace initialization { } initialization In C++98, the standard allows the use of curly braces {} for uniform list initialization […]

decltype and template function specialization in type extraction

Table of Contents foreword 1. The decltype keyword 1. Get variable type 2. Get the expression type 3. Get the expression (function) type 4. Used for the return value type of the perfect forwarding function in the proxy mode 2. Partial specialization and full specialization of templates 3. Functions can also be used as function […]

[C++] auto and decltype in C++

About auto auto placeholder When multiple variables are declared with an auto keyword, the compiler follows the deduction rules from left to right, and infers the concrete type of auto with the leftmost expression: int n = 5; auto *pn = &n, m = 10; In the above code, because &n is of type int […]

C++11 (1) (list initialization, variable type deduction (auto, decltype), nullptr, range for loop, etc.)

Directory Introduction to C++11 list initialization In C++98, {} initialization problem List initialization of built-in types List initialization of custom types variable type deduction auto decltype nullptr range for loop final and override Control of default member functions explicit default function remove default function Introduction to C++11 In 2003, the C++ Standards Committee submitted a […]