摘要: 1:#include <boost/smart_ptr.hpp>#include <iostream>#include <string>using namespace std;using namespace boost;int main(){ int *a = new int(10); { scoped_ptr<int> sp (a); cout<<*sp<<endl; //10 } cout<<*a<<endl; //8916792}注意这里,只有一份拷贝,因此不管是 scoped_ptr 出作用 阅读全文
posted @ 2011-09-16 11:54 王帅901 阅读(901) 评论(0) 推荐(0)