Boost logo

Boost :

Subject: Re: [boost] Interest in a container which can hold multiple data types?
From: Thijs (M.A.) van den Berg (thijs_at_[hidden])
Date: 2015-05-05 02:31:43


>>
>> tuple_vector<Point, Line, Rectangle, Circle> shapes;
>> shapes.push_back(Point{1.0, 1.0} );
>
> This is neat, but it' not quite the same thing. Unlike std::vector<boost::any>, your tuple_vector does not organize objects into strictly linear arrangement. Using your example, there is no way to draw shapes in the order they were inserted into container.
>
Good point! So it loses overall ordering, only preservers it at the type level. The reason is that objects gets stored in linear memory per type.


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