class A {};
typedef shared_ptr<const A*> AConstPtr;
typedef shared_ptr<A*> APtr;
vector<APtr> ptr;
const vector<AConstPtr>* foo()
{
return &ptr;
}
This code does not compile, because "there is no implicit conversion from vector<
Aptr>
* to const vector<
AConstPtr>
* "
Is there anyway to make this work, without creating a new vector, and without using an unsafe cast?
因此,我之所以需要,是因为我有一个在内部把清单作为矢量代码(<><Ptr>
的班子,但需要通过接口使清单完全一致。