I currently have a vector of pointers, how would I cout
the information at a particular pointer in the vector?
I am looking at how to deference the address stored in the vector.
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";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.