I’m building a dual-stream system which depends on some events so the program can choose what stream to use (database or file).
I had the idea of simulating the database when using the file, and came up with this:
a std::list would be as a SqlRow and the map would be the respective associated column and value values.
in order to illustrate:
typedef map<string, string> SqlColumn;
typedef list<SqlColumn> SqlRow;
and defining it like this SqlRow *data = new SqlRow(0);
I get an error when I do something like this: data[row].insert(make_pair("Key", "Value"));
error C2661: 'std::list<_Ty>::insert' : no overloaded function takes 1 arguments
1> with
1> [
1> _Ty=SqlColumn
1> ]
I mean, it seems that the compiler is creating some kind of multidimensional list. Cause if I place some other dimension there, it works. (it actually gives me another error. But it does point to the map I want. The error has nothing to do with it. But I’ll post it.)
Can somebody tells me what the hell is happening?
Additional information: error C2676:
binary '[' : 'SqlRow' does not define this operator or a conversion to a type acceptable to the predefined operator
error C2228: left of '.insert' must have class/struct/union
I’m not a C++ expert, but I don’t think you can do
data[row]withdatabeing an object pointer.