
24 Jul
2008
24 Jul
'08
9:02 p.m.
Bradford, Chase wrote:
int main() { typedef basic_soa<std::string, boost::variant<int, float> > MySoa;
MySoa s;
// Make internal vectors hold 100 elements. s.resize(100);
// Create a fields named x and y. This sort of makes the object a // container of 2D points. s.add_field<float>("x"); s.add_field<float>("y");
fill( s.field<float>("x").begin(), s.field<float>("x").end(), rand); fill( s.field<float>("y").begin(), s.field<float>("y").end(), rand);
If I understand your example correctly, it's quite similar to a std::(unordered_)map<Key, std::vector<Value> >.