I am having problems initializing this class:
class Table{
public:
long r;
long c;
int g;
int q;
std::vector<std::vector<long> > data;
//Helper Methods
Table(){r=-1;c=-1;g=-1; q=-1;data.clear();};
double rate(void) const {...};
bool check(void) const {...};
void q_auto(void){q = r / g;};
}
If I try with this:
static Table my_table = {16200, 10800, 360, 30, {{1,3},{2,5}}};
It simply fails with:
error: could not convert ‘{16200, 10800, 360, 30, {{1, 3}, {2, 5}}}’ from ‘<brace-enclosed initializer list>’ to ‘Table’
I do have C++11. So, what is wrong there? I tried with extra braces, but no luck.... I am using g++.
The class was not supposed to be hand-written, but I know the values are correct, and just want to stick the table as a global value. Without any extra internal callings to get the final table values.
Aucun commentaire:
Enregistrer un commentaire