|
Boost : |
From: Sebastien Binet (hep.sebastien.binet_at_[hidden])
Date: 2008-07-24 17:09:25
On Thursday 24 July 2008 14:02:37 Mathias Gaunard wrote:
> 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> >.
except that it seems to be able to handle different value-types.
In my field, this is what we call an n-tuple:
http://www.gnu.org/software/gsl/manual/html_node/N_002dtuples.html
http://www.gnu.org/software/gsl/manual/html_node/Ntuple-References-and-Further-Reading.html
cheers,
sebastien.
-- ################################### # Dr. Sebastien Binet # # Lawrence Berkeley National Lab. # # 1 Cyclotron Road # # Berkeley, CA 94720 # ###################################
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk