#include<iostream>
#include<vector>
usingnamespace std;
template <class T>
class ShortestPathTable
{
private:
struct box
{
T name;
T parent;
int value;
};
box* table;
int sizeT;
public:
ShortestPathTable(int size, vector<T> vec)
{
table=new box[size];
sizeT=size;
int i=0;
for(vector<T>::iterator it=vec.begin();it!=vec.end();it++)
{
box[i].name=*it; //line 27
box[i].parent= *it;
box[i].value=-1;
i++;
}
}
};
It has to make a "table" that is from boxes that has name, parent and a value. The constructor needs a size and a vector with names (like (1,2,3,4) or (a,b,c,d)) and it has to make 4 boxes with these names.
But it gives me some mistakes and they say " syntax error : missing ';' before '[' " on lines 27,28,29. I think the problem is in the for syntax but I can't find it.