Is there any data structure for a table? like storing this:
Width Height
1 5 10
2 3 20
3 10 2
What I need is to address a value by row number and title, e.g. (2, “Height”) will give 20.
I know I can do an array of maps or 2d array and a map as column name to number, but is there a ready data structure for this?
Have you looked at Boost::MultiIndex yet? It’s almost like an in-memory representation of a database table. You can query on several rows, a single row, and such. Very powerful, very useful, and I think it would solve the issue you’re asking.
Taken from the boost website:
In your case, I’d look at the composite_key.