[C++] Inline functions, auto keyword, range-based for loop, pointer null value nullptr

Fan Zimu: Personal homepage Personal columns: “C Language” “Data Structure” “Lanqiao Cup Test Questions” “LeetCode Question Notes” “Practical Training Projects” “C++” Every day without dancing is a betrayal of life Table of Contents Preface 1. Inline functions 1.1 Concept 1.2 Features 2.auto keyword 2.1 Thinking about type aliases 2.2Introduction to auto 2.3Usage details of auto […]

[C++]: auto keyword (C++11) + range-based for loop (C++11) + pointer null value nullptr (C++11)

auto keyword (C++11) As the program becomes more and more complex, the types used in the program become more and more complex, often reflected in: Type is difficult to spell Unclear meaning leads to error-prone #include <string> #include <map> int main() {<!– –> std::map<std::string, std::string> m{<!– –> {<!– –> “apple”, “apple” }, {<!– –> “orange”, […]

C++auto & range for & nullptr

Table of Contents One, auto 1. Thinking about type aliases 2. Introduction to auto 3. Details of using auto 1. Auto is used in combination with pointers and references. 2. Define multiple variables on the same line 3. Scenarios where auto cannot be deduced 2. Range-based for loop 1. The syntax of range for 2. […]

(default parameter) & (function overloading) & (reference) & (inhibited) & (nullptr in C++)

(default parameters) & amp; (function overloading) & amp; (reference) & amp; (inhibited) & amp; (atuo usage) & amp; (NULL in C++) 1.Default parameters 1.1 Concept of default parameters 1.2 Classification of default parameters 1.3 Notes on default parameters 2. Function overloading 2.1 The concept of overloading 2.2 C++ supports the principle of function overloading-name modification […]

[Elementary C++] Reference&inline function&auto keyword&range for loop&nullptr

================================================== ======================= There are more series of columns on the personal homepage: Xiaobai is not a program Yuan My little warehouse: Gitee C++ series column: C++ headache ================================================== ======================= Table of Contents Preface Quote concept Characteristics of citations Often quoted Referenced usage scenarios Make parameters do return value The difference between reference and pointer The […]

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++ […]

[QandA C++] Summary of key knowledge on references, pointers, rewriting, overloading, redefinition, public, protected, private, friends, deep and shallow copies, new, malloc, nullptr, NULL, destructor, etc.

Table of Contents The difference between reference and pointer rewrite, overload, redefine public/protected/private friends Deep copy and shallow copy new and malloc pointer array, array pointer constant pointer, pointer constant nullptr and NULL What is a destructor The difference between references and pointers A pointer is an entity and needs to allocate memory space, while […]

C++ New Classic 08–Range for, new memory dynamic allocation and nullptr

Scope for statement I have learned the for statement in the C language part. In C++11, the capability of the for statement has been further expanded, and the range for statement has been introduced, which is used to traverse a sequence. Take a look at the following example: int v[]{12,13,14,16,18}; //Each element in array v […]

C++ inline function/auto/scope for/nullptr

Article directory inline function The concept of inline functions Features of inline functions keyword auto rangefor null pointernullptr Inline functions First of all, to review, the essence of macros is substitution, which means that semicolons cannot be used at the end of macros #define ADD(x, y) x + y; printf(“%d”, ADD(1, 2)); For example, the […]

C++11 standard default function control, pointer control nullptr,,,

1. Pointer null value nullptr #include <iostream> using namespace std; void fun(char* c) {<!– –> printf(“invoke f(char*)\ “); } void fun(int i) {<!– –> cout << “invoke f(int)” << endl; } int main() {<!– –> fun(0); fun(NULL); fun(nullptr); //nullptr can be implicitly converted to a pointer type return 0; } #include <iostream> #include <cstddef> using […]