假設我的結構或類看起來像這樣: 在多個聚合級別的支持操作
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?