先来看下面的赋值语句:
auto_ptr< string> ps (new string ("I reigned lonely as a cloud."));
auto_ptr<string> vocation;
vocaticn = ps;
上述赋值语句将完成什么工作呢?如果ps和vocation是常规指针,则两个指针将指向同一个string对象。
先来看下面的赋值语句:
auto_ptr< string> ps (new string ("I reigned lonely as a cloud."));
auto_ptr<string> vocation;
vocaticn = ps;
上述赋值语句将完成什么工作呢?如果ps和vocation是常规指针,则两个指针将指向同一个string对象。