Boost logo

Boost :

From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2008-07-24 17:02:37


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> >.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk