Boost logo

Boost :

Subject: Re: [boost] Heterogeneous Container Library (HCL) Feedback and Testing
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2015-06-03 16:42:07


2015-06-03 21:55 GMT+02:00 James Armstrong <armstrhu_at_[hidden]>:

> On Wed, Jun 3, 2015 at 9:24 AM, Andrzej Krzemienski <akrzemi1_at_[hidden]>
> wrote:
>
> >
> > Hi James,
> > I think I missed your previous announcement, so pardon me if I am asking
> > something you have already explained. What is the typical use case you
> are
> > trying to address, fromthe example on GitHub, I gather that:
> >
> > heterogeneous::heterovector<int, double, std::string, double> hv;
> >
> > Is an alternative to:
> >
> > struct vectors
> > {
> > std::vector<int> ints;
> > std::vector<double> doubles;
> > std::vector<std::string> strings;
> > std::vector<double> doubles1;
> > } hv;
> >
> > Does it offer any advantages over the latter? Could you compare them,
> > so that I know what I ain by switching to your library?
> >
> > Regards,
> >
> > &rzej
> >
> >
> Andrzej,
>
> Thanks for the response. So yes, your example would provide pretty much
> the same functionality. The heterocontainers would then be just a clean
> interface to allow users to access the data without having to have an
> ints0, ints1, int2, floats0, float1 and so forth in the struct. Maybe not
> completely unique thing, but one could argue that a tuple<int,doubl,float>
> provides not much in additional benefit over what you could do with a
>
> class tuple
> {
> int int_;
> double double_;
> float float_;
> };
>
> and defining a few methods to access that data.
>
>
> My original idea was to have a container which does not require the user to
> explicitly declare what data types the container will hold up front. Then,
> for example, one could easily store insert the results of a database query
> where the return type is not known at compile time. After some discussion,
> it was determined that rather than having a dedicated container for this,
> having generic methods which work with any sequence container of
> boost::any/boost:variant or similar would be more flexible. That is
> provided in the adaptor.hpp header with examples in example_adaptor.cpp.
> There seemed to be some decent interest in the polymorphic collections
> concept, and while what I have done isn't exactly the same, I think it is
> close in concept. I figured it wasn't too much work so I went ahead and
> did that as well.
>

Could you provide some sketch of a real life scenario? The examples show
how I can use it, but I fail to imagine why I would need it. You mentioned
storing the results of various DB queries, how would you make use of data
stored in such way?

Reards,
&rzej


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