我目前有一个指针向量,我如何cout
向量中特定指针的信息?
我正在研究如何推测存储在向量中的地址。
答案 0 :(得分:2)
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.
答案 1 :(得分:0)
std::vector<int*> ints;
for ( auto cur = ints.begin(); cur != ints.end(); ++cur)
{
std::cout << (*(*cur)) << "\n";
}