#include <iostream> #include <vector> #include <map> using namespace std; #define LINE_FUNCSIG cout << __LINE__ << ' ' << __FUNCSIG__<< endl; #define COMMA , #define SHOW_CODE(_code_) cout << #_code_ << ' '<< endl; _code_ struct cfoo { cfoo() { cout << "constructor "; LINE_FUNCSIG } cfoo(const cfoo&) { cout <<"copy constructor "; LINE_FUNCSIG } cfoo(cfoo&&) { cout << "move constructor "; LINE_FUNCSIG } ~cfoo() { cout<<"destructor "; LINE_FUNCSIG } }; int main() { SHOW_CODE(cfoo _cfoo;) vector<cfoo> _vector; SHOW_CODE(_vector.push_back(_cfoo);) map<int, cfoo> _map; SHOW_CODE(_map.insert({ 159 COMMA _cfoo });) SHOW_CODE(_map.emplace(357 COMMA cfoo());) cout << "FINI" << endl; return 0; }
cfoo _cfoo; constructor 12 __cdecl cfoo::cfoo(void) _vector.push_back(_cfoo); copy constructor 13 __cdecl cfoo::cfoo(const struct cfoo &) _map.insert({ 159 COMMA _cfoo }); copy constructor 13 __cdecl cfoo::cfoo(const struct cfoo &) move constructor 14 __cdecl cfoo::cfoo(struct cfoo &&) destructor 15 __cdecl cfoo::~cfoo(void) _map.emplace(357 COMMA cfoo()); constructor 12 __cdecl cfoo::cfoo(void) move constructor 14 __cdecl cfoo::cfoo(struct cfoo &&) destructor 15 __cdecl cfoo::~cfoo(void) FINI destructor 15 __cdecl cfoo::~cfoo(void) destructor 15 __cdecl cfoo::~cfoo(void) destructor 15 __cdecl cfoo::~cfoo(void) destructor 15 __cdecl cfoo::~cfoo(void)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)