can the boost multi-array be easily extended to std::map's?
I'm working on an application (a data analysis system built in C++) for
which it would be helpful to have nested (multidimensional) containers
other than ordinary arrays. I have defined a generic 'data' class which
I like to store in std::vector's. For a very simple example, a
'data' might be a double representing a student's score on an exam, or
in more complex settings it might be some sort of spatial map, or a
multidimensional set of records for a medical patient.
I am interested in structures where 'data' is nested across multiple
levels. For example, test scores are nested within students, students
nested within teachers, nested within school districts, etc. For a
single layer of nesting a std::map
On Mon, 23 Aug 2004 08:42:09 -0700, Steven L. Scott
I'm working on an application (a data analysis system built in C++) for which it would be helpful to have nested (multidimensional) containers other than ordinary arrays.
I've been toying with using boost::variant for something like this -
an arbitrarily nested data structure that could be used like the
hashes in Perl/Python etc. Unfortunately, because boost::variant
doesn't know about the std::map operators, you can't use code like
thedata["first"]["second"] but you can write something like this
(data_t is used just to gain the syntactic sugar of
std::map::operator[])
#include <map>
#include <string>
#include
participants (2)
-
Caleb Epstein
-
Steven L. Scott