|
Boost : |
Subject: Re: [boost] Interest in a container which can hold multiple data types?
From: Boris Rasin (boris_at_[hidden])
Date: 2015-05-05 17:37:41
On 5/5/2015 9:04 PM, James Armstrong wrote:
> You're correct in that a vector<boost::any> can achieve the same thing, and
> that would probably be the better way to implement this internally. I
> guess the proposal would be to provide the container interface to give some
> data modification functions and iterators which iterate over only a given
> type and such. That way there would be a standardized container with
> methods to deal with the data in a type specific way.
>
But why do you need special container type if all you want are
algorithms and iterator adapters? Like I said before, this could be
useful, but wouldn't it be better to write this as generic algorithms
capable of working with any container of boost::any, not just vector?
Better yet, any container of type erased or discriminated union objects
(boost::any, boost::type_erasure::any, boost::variant, eggs::variant, etc.)?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk