An easy to use grid like random access/dynamic container?
I have been using STL containers to store structures of data but I would like to know if there is an easier solution such as a dynamically sized container that stores data in a spreadsheet like fashion. For example, I would like to store rows of columns of different data types. Here is a sample of data I would like to store, also, I would like fast random access to the elements to read and modify existing data: Name, Age, HomeOwner John 42 true Mark 24 false Mary 29 true If anyone can suggest such a container please let me know. Thank you
2007/4/28, Jeff
I have been using STL containers to store structures of data but I would like to know if there is an easier solution such as a dynamically sized container that stores data in a spreadsheet like fashion.
For example, I would like to store rows of columns of different data types.
Here is a sample of data I would like to store, also, I would like fast random access to the elements to read and modify existing data:
Name, Age, HomeOwner John 42 true Mark 24 false Mary 29 true
If anyone can suggest such a container please let me know.
boost::tuple (now tr1::tuple) will do:
Something like:
boost::tuple
On 4/28/07, Jeff
I have been using STL containers to store structures of data but I would like to know if there is an easier solution such as a dynamically sized container that stores data in a spreadsheet like fashion.
For example, I would like to store rows of columns of different data types.
Here is a sample of data I would like to store, also, I would like fast random access to the elements to read and modify existing data:
Name, Age, HomeOwner John 42 true Mark 24 false Mary 29 true
If anyone can suggest such a container please let me know.
Thank you
Try Boost.MultiIndex If you just want to store that data, structs are all you need. But I assume that you are implying that you might want to search or sort, etc, based on each field. In that case take a look at multi-index. Tony
Tony & Alberto, Thanks for responding. I will be looking at both tuple and multi_index. Oh, and Tony, although I failed to mention it, you were correct in assuming that I want to seek/sort on any column. Best Regards, Jeff
participants (3)
-
Alberto
-
Gottlob Frege
-
Jeff