【发布时间】:2011-06-26 17:30:59
【问题描述】:
如何转换 shared_ptr 类型向量的迭代器?考虑以下示例:
typedef boost::shared_ptr < MyClass > type_myClass;
vector< type_myClass > vect;
vector< type_myClass >::iterator itr = vect.begin();
while(itr != vect.end())
{
//Following statement works, but I wish to rather cast this
//to MyClass and then call a function?
(*itr)->doSomething();
}
【问题讨论】:
标签: c++ boost iterator shared-ptr