智能指定的转换问题
接口返回auto_ptr
std::auto_ptr<classsObj> tmp1=getOBj(***)
后面需要用到,但要求类型为boost::shared_ptr,所以想把它保存到map中
std::map<string,boost::shared_ptr<classsObj>> ComMocList;
ComMocList.insert("test1",boost::shared_ptr<classsObj>(tmp1.release())));
接口类型无法改动。这样使用会core。是否只能重新生成boost::shared_ptr类型的类对像?类很大,最好不要这样做,请问还有其它方法吗
[解决办法]
这里看没有问题样. 中间使用的时候有没有把 tmp1 赋值给其它的变量吧? 或者做为参数传递给其它函数?