rule_of_five

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-11-24 00:00:00 +00:00
parent 2abb994752
commit fa8c2ee521
2 changed files with 133 additions and 8 deletions

View File

@@ -2509,6 +2509,9 @@ Note that secondary cores in gem5 are kind of broken however: <<gem5-gdb-step-de
Bibliography:
* https://stackoverflow.com/questions/10490756/how-to-use-sched-getaffinity-and-sched-setaffinity-in-linux-from-c/50117787#50117787
** https://stackoverflow.com/questions/663958/how-to-control-which-core-a-process-runs-on/50210009#50210009
** https://stackoverflow.com/questions/280909/cpu-affinity/54478296#54478296
** https://unix.stackexchange.com/questions/73/how-can-i-set-the-processor-affinity-of-a-process-on-linux/441098#441098 (summary only)
* https://stackoverflow.com/questions/42800801/how-to-use-gdb-to-debug-qemu-with-smp-symmetric-multiple-processors
=== Linux kernel GDB scripts
@@ -20225,14 +20228,6 @@ Programs under link:userland/cpp/[] are examples of https://en.wikipedia.org/wik
* link:userland/cpp/empty.cpp[]
* link:userland/cpp/hello.cpp[]
* classes
** constructor
*** link:userland/cpp/initializer_list_constructor.cpp[]: documents stuff like `std::vector<int> v{0, 1};` and `std::initializer_list`
*** link:userland/cpp/most_vexing_parse.cpp[]: the most vexing parse is a famous constructor vs function declaration syntax gotcha!
**** https://en.wikipedia.org/wiki/Most_vexing_parse
**** http://stackoverflow.com/questions/180172/default-constructor-with-empty-brackets
** `virtual` and polymorphism
*** link:userland/cpp/virtual.cpp[]
* iostream
** link:userland/cpp/copyfmt.cpp[]: `std::copyfmt` restores stream state, see also: https://stackoverflow.com/questions/12560291/set-back-default-floating-point-print-precision-in-c/53673686#53673686
* fstream
@@ -20247,6 +20242,61 @@ Programs under link:userland/cpp/[] are examples of https://en.wikipedia.org/wik
*** link:userland/cpp/multimap.cpp[]: `std::multimap`
** <<algorithms>> contains a benchmark comparison of different c++ containers
[[cpp-classes]]
==== C++ classes
[[cpp-constructor]]
===== C++ constructor
* link:userland/cpp/initializer_list_constructor.cpp[]: documents stuff like `std::vector<int> v{0, 1};` and `std::initializer_list`
* link:userland/cpp/most_vexing_parse.cpp[]: the most vexing parse is a famous constructor vs function declaration syntax gotcha!
** https://en.wikipedia.org/wiki/Most_vexing_parse
** http://stackoverflow.com/questions/180172/default-constructor-with-empty-brackets
* `virtual` and polymorphism
** link:userland/cpp/virtual.cpp[]
[[cpp-rule-of-five]]
====== C++ rule of five
link:userland/cpp/rule_of_five.cpp[]
Output Ubuntu 20.04 GCC 9.3:
....
constructor?
constructor
copy?
constructor
copy
copy assignment?
constructor
copy assignment
constructor
copy
move assignment
destructor
move?
constructor
move?
constructor
constructor
move assignment
destructor
a bunch of destructors?
destructor
destructor
destructor
destructor
destructor
....
https://en.cppreference.com/w/cpp/language/rule_of_three
[[cpp-standards]]
==== C++ standards