I'm trying to implement a 2-dimensional error lookup table, where each error ID has a (string) description and a 'Fatal' tag. What is the best way to do this? I am rather new to c++, and only a hobbyist, but I don't want simple solutions that I have to un-learn later.
My current solution is to have 2 vectors of vectors, to hold the description and 'fatal' tag. To accomplish this, I am using the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
class errinfo
{
public:
std::vector<std::vector<std::string> > ErrTable;
std::vector<std::vector<bool> > ErrFatal;
errinfo();
};
errinfo::errinfo()
{
ErrTable.resize(255);
for (int i = 0; i < ErrTable.size( ); i++)
ErrTable[i].resize(255);
ErrFatal.resize(255);
for (int i = 0; i < ErrFatal.size( ); i++)
ErrFatal[i].resize(255);
// . . . Initializing the entries
}
I want to know if this is the best way to do this.
Is that still a two dimensionally indexed array? I can't tell. I'm sorry if this is obvious, but I don't see it. I want to be able to reference error 2:3. I am looking for the simplest, most efficient solution.