?????????auto_ptr ??????C++????????????????壬???????new/delete???????????????????????????????ζ????????delete??????檔?????????б????????????????
????????????μ?8???????????auto_ptr????????????
????1. auto_ptr??????
????auto_ptr ??C++?????????????壬auto_ptr?????????????????new??????????棬??????????????????????治????????????????????????auto_ptr)??
??????auto_ptr??????????????????????????????auto_ptr??????е?????????????????????????????????????????????????????????auto_ptr?????new ???顣
????2. auto_ptr???????????????
????#include <memory>
????3. ?????auto_ptr??????????
????1) ??????
????1] ??????????????????????????????????
????int* p = new int(33);
????auto_ptr<int> api(p);
??????????api???????????????????????????????????????????delete???????е???棬????????????д???μ????
????delete p;
????2] ?????????????
????auto_ptr< int > api( new int( 33 ) );
????2) ????????
??????????????????????????????μ????????
????auto_ptr< string > pstr_auto( new string( "Brontosaurus" ) );
????auto_ptr< string > pstr_auto2(pstr_auto );  //????pstr_auto??????pstr_auto2
????????auto_ptr?????????????????鶯???棬????????????????????????????????
??????????????????У?pstr_auto???????????????????????pstr_auto2?????á?
????pstr_auto2????????????????????
????3) ???
??????????????????????????????μ????????
????auto_ptr< int > p1( new int( 1024 ));
????auto_ptr< int > p2( new int( 2048 ));
????p1 = p2;
??????????????p1 ??????????????????p1 ???int ???????????????????2048?? p2 ????????????????
????4. ???auto_ptr ??????????
?????????????????????????????????????????Null???丳???
??????????????????????????????0?????????????????auto_ptr???????£?
????auto_ptr< int >p_auto_int;  //?????????????
????5. ???????auto_ptr????????????????????棩
????????auto_ptr?????????С?????????????????檔???????μ????????????
????int* p = new int(0);
????auto_ptr<int> ap1(p);
????auto_ptr<int> ap2(p);
????????ap1??ap2?????????p????????????????????????p?????????????????????????C++?????????ж?????????????????????????auto_ptr??