简体   繁体   中英

What does this C++ statement mean?

void max_idxs(vector<int> &pidxs){
   vector<fragment *> ids;
   max_ids(ids);

   for(size_t i = 0; i < ids.size(); i++){
    int weight_idx = ids[i]->weight_idx; //Get weight index
   }
}

In this C++ code, what does it mean by int weight_idx = ids[i]->weight_idx; ?

What does -> mean?

Thanks!

x->y means (*x).y . In other words, "take the address pointed to by x , and get the variable y from the object there". Here, it means it'll get the weight_idx from the fragment pointed to by ids[i] .

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