請告訴我,如果在這裏需要一些更多的信息: 全局聲明:錯誤: '類的std ::矢量<路線,性病::分配器<route>>' 沒有名爲成員 'exitPoint'
typedef struct route
{
int exitPoint;
bool allBranchesTraversed;
} route;
****vector <route> routeVector;****
int main()
{
....
do
{
****currentExitPoint = returnShortestWeightedBranch (&routeVector);****
if (currentExitPoint != -1)
{
objRoute.exitPoint = currentExitPoint;
routeVector.push_back (objRoute);
}
else
{
break;
}
} while (1);
}
的錯誤是在本功能與**行:
int returnShortestWeightedBranch (vector <route> *objRouteVector)
{
....
for (unsigned int h = 0; h < objRouteVector->size(); h++)
{
// Locate 'currentExitPoint' in the vector 'exitPointDetailsVector'.
for (i = 0; i < exitPointDetailsVector.size(); i++)
{
// If located
****if (objRouteVector[h].exitPoint == exitPointDetailsVector[i].exitPoint)****
{
// For all the branches of the 'currentExitPoint',
for (j = 0; j < exitPointDetailsVector[i].branchesVector.size(); j++)
{
...............
}
罪魁禍首FUNC正從所謂
謝謝,這工作,現在如果我寫'矢量&objRouteVector'我該如何訪問它?你上面顯示的方式也適用於這個參考? –
@Anisha:就像正常一樣訪問它。使用引用時,不存在訪問基礎對象的額外語法。 –