????6. ???????????????????
????1) ?????????????????霉???????????????????谢????????????????????????auto_ptr(????????)???????????????auto_ptr?????????????????????????????????????????auto_ptr?????????????????
????void f(auto_ptr<int> ap)
????{
????cout<<*ap;
????}
????auto_ptr<int> ap1(new int(0));
????f(ap1);
????cout<<*ap1; //????????f(ap1)?????????ap1?????????胁????????????
????2) ??????????????????????????????????????
??????????????????????卸?????auto_ptr?????????????????些??????????????????????????????????????????????????
?????????const reference????????????????????????
????7. auto_ptr??????????????????
?????????easy??delete ??????????????????????????????????卸????????????
????8. auto_ptr??????????????
????1) get()
????????auto_ptr???????????????????????????????
????int* p = new int(33);
????cout << "the adress of p:"<< p << endl;
????auto_ptr<int> ap1(p);
????cout << "the adress of ap1:" << &ap1 << endl;
????cout << "the adress of theobject which ap1 point to: " << ap1.get() << endl;
??????????????锟�?
????the adress of p: 00481E00
????the adress of ap1: 0012FF68
????the adress of the object which ap1point to: 00481E00
?????????????????????????int????????????????
???????????ap1??????????????????????
????2) reset()
?????????????auto_ptr???????
????????????????????????????????????????????????auto_ptr????reset()???????????????
????auto_ptr< string > pstr_auto( new string( "Brontosaurus" ) );
????pstr_auto.reset( new string("Long -neck" ) );
???????????小??????pstr_auto???"Brontosaurus"???????????????????????????????pstr_auto?????"Long -neck"?????????????
???????reset(0)???????????????妾�
????3) release()
????????auto_ptr???????????????????????????????????????
???????????????auto_ptr????????????auto_ptr???????????????????????get??????????
???????????????锟�?
????auto_ptr< string > pstr_auto( new string( "Brontosaurus" ) );
????auto_ptr< string > pstr_auto2(pstr_auto.get() ); //????????auto_ptr???????????
????auto_ptr< string > pstr_auto2(pstr_auto.release() ); //release??????????????