简体   繁体   中英

How to iterate through this std::vector?

I have this pointer to std::vector as a class member:

std::vector<std::vector<vec3d<GLshort>*>*> *faces = new std::vector<std::vector<vec3d<GLshort>*>*>();

To iterate it I am trying this:

std::vector<std::vector<vec3d<GLshort>*>*>::iterator it;
for (it = this->faces->begin();
    it != this->faces->end();
    ++it) {
    it->...
}

It does not allow me to access to it members. What am I missing?

You should change it-> to (*it)-> in your code. Because it is working like a std::vector<> **it in your code.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM