C++11 | new features [common series]

1, Keywords 1.1 alignas func: the specifier can be applied to the declaration of variables, non bit field class data members, class/struct/union and enumeration definitions. Cannot be applied to parameters;Note: but it is weaker than the original alignment; struct alignas(8) S {}; struct alignas(1) U { S s; }; // Error: if there is ...

Added by Slippy on Fri, 04 Mar 2022 13:25:44 +0200

Analysis of std::function source code of C++11

1. Source code preparation This article is based on the analysis of the source code of gcc-4.9.0. std::function is added to the standard only after C++11. Therefore, the lower version of GCC source code does not have std::function. It is recommended to choose 4.9.0 or later version to learn. The difference between different versions of ...

Added by jaybones on Sat, 29 Jan 2022 20:10:00 +0200

Some common features of C++11 (stability and compatibility)

Some common features of C++11 (stability and compatibility) 1, Original literal The literal quantity defining the original string is added in C++11. The definition method is: R "xxx (original string) xxx", in which the strings on both sides of () can be omitted. The original literal R can directly represent the actual meaning of the ...

Added by abhikerl on Wed, 26 Jan 2022 05:27:44 +0200

C + + 11 decltype (network collation)

decltype introduction The emergence of type derivation at compile time is just for generic programming. In non generic programming, our types are determined and there is no need to deduce at all. For compile time type derivation, in addition to the auto keyword we mentioned, there is also decltype in this paper. Decltype, like the auto keywo ...

Added by greyhoundcode on Mon, 17 Jan 2022 19:00:22 +0200

C++11 -- multithreaded programming 16 how to stop or terminate threads?

In this article, we will discuss how to stop or terminate threads in C++11. C++11 does not provide a direct method to stop a running thread because some resources of the thread may be released or closed before exiting, i.e If a thread obtains a lock and we suddenly kill that thread, who will release the lock? If a thread opens a file to write ...

Added by drag0ner on Mon, 22 Nov 2021 14:25:15 +0200

inline variable in c++17

1, Introduction to inline It is estimated that anyone who has studied c + + knows the keyword inline. In the application of functions, there is the use of inline functions (for specific usage, please refer to the previous articles, which will not be expanded here). Inline function ensures that the function has the same copy in each compilation ...

Added by pcjackson06 on Sat, 06 Nov 2021 13:29:46 +0200