假设我的结构或类看起来像这样: 在多个聚合级别的支持操作
struct foo{ string attribute_1; int attribute_2; string attribute_3;
int value_1; int value_2; double value_3; };
What are some good ways of supporting aggregate operations on collections of foo across the different attributes? E.g. I might want to sum value_1 where attribute_1 is something, or where attribute 2 is something and attribute 3 is something.
I have been using boost::multi_index to do this but I'd like to hear how other people do this. Perhaps when you need this kind of ability, it's better to use to embed an in-memory database. What have other people done for this?