访问指针向量中的信息

accessing information in a vector of pointers

本文关键字:信息 向量 指针 访问      更新时间:2023-10-16

我当前有一个指针向量,如何cout向量中特定指针处的信息?

我正在研究如何尊重存储在矢量中的地址。

vector<MyType*> addressList;
cout<<(*(addresssList[i])).Data ; //assuming Data is the content you want to output and you would like to output the content addressed by the `ith` element.
std::vector<int*> ints;
for ( auto cur = ints.begin(); cur != ints.end(); ++cur)
{
     std::cout << (*(*cur)) << "n";
}