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 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]
.
精彩评论