开发者

What does this C++ statement mean?

开发者 https://www.devze.com 2023-01-11 05:58 出处:网络
void max_idxs(vector<int> &pidxs){ vector<fragment *> ids; max_ids(ids); for(size_t i = 0; i < ids.size(); i++){
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 w开发者_如何学JAVAeight 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].

0

精彩评论

暂无评论...
验证码 换一张
取 消