【发布时间】:2013-09-21 11:26:34
【问题描述】:
这很好用:
udtCandidate firstCand;
firstCand=uSeqs[i].Candidates.front();
这将创建 udtCandidate 的副本。
但我需要引用它,而不是副本。
然而
udtCandidate firstCand;
firstCand=&uSeqs[i].Candidates.front();
不起作用。 编译器告诉我没有二元运算符“=”接受“udtCandidate *”类型的右手操作数。
有人知道我做错了什么吗?
声明如下:
struct udtCandidate
{
udtJoinFeatures JoinFeaturesLeft;
udtJoinFeatures JoinFeaturesRight;
udtByteFeatures ByteFeaturesLeft;
udtByteFeatures ByteFeaturesRight;
int iHPUnitIDLeft;
int iHPUnitIDRight;
double targetCost;
vector<unsigned long>bestPath;
double bestPathScore;
bool hasAncestor;
};
struct udtCandidateSequence
{
double Score;
vector<udtCandidate>Candidates;
};
【问题讨论】:
标签: c++ windows object reference