这个C ++语句是什么意思? [英] What does this C++ statement mean?
本文介绍了这个C ++语句是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
}
}
在这个C ++代码中,是 int weight_idx = ids [i] - > weight_idx;
?
In this C++ code, what does it mean by int weight_idx = ids[i]->weight_idx;
?
- >
是什么意思?
谢谢!
推荐答案
x-> y
表示(* x).y
。换句话说,获取 x
指向的地址,并从那里的对象获取变量 y
。这里,它意味着它将从指向的
。片段
中获取 weight_idx
i]
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]
.
这篇关于这个C ++语句是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文