A
Apricot
#include <iostream>
#include <string>
#include <map>
using namespace std ;
class tst
{
public :
tst() { cout << "tst::constructor" << endl ; }
tst(const tst & that) { cout << "tst::copy constructor" << endl ;
}
tst & operator =( const tst & that ) { cout << "tst:
perator ="
<< endl ; }
~tst() { cout << "tst::destructor" << endl ; }
} ;
int main()
{
map < string , tst > a ;
tst e ;
a.insert(pair < string , tst > ("standard",e) ) ;
system("pause") ;
return 0 ;
}
///// Output ////////////
tst::constructor
tst::copy constructor
tst::copy constructor
tst::copy constructor
tst::destructor
tst::destructor
#include <string>
#include <map>
using namespace std ;
class tst
{
public :
tst() { cout << "tst::constructor" << endl ; }
tst(const tst & that) { cout << "tst::copy constructor" << endl ;
}
tst & operator =( const tst & that ) { cout << "tst:
<< endl ; }
~tst() { cout << "tst::destructor" << endl ; }
} ;
int main()
{
map < string , tst > a ;
tst e ;
a.insert(pair < string , tst > ("standard",e) ) ;
system("pause") ;
return 0 ;
}
///// Output ////////////
tst::constructor
tst::copy constructor
tst::copy constructor
tst::copy constructor
tst::destructor
tst::destructor