Boost logo

Boost Users :

Subject: Re: [Boost-users] Designing a table-like data structure with Fusion
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-01-26 22:58:12


AMDG

Matthias Vallentin wrote:
> I am in the process of designing a table-like data structure and would
> like to hear your feedback on the choice of Fusion for this task. In the
> context of databases, a table contains multiple columns that exhibit
> different types (short, unsigned int, long long, etc...). Columns must
> be added at runtime. The table is column-oriented in that it stores each
> column individually, yet provides a row-oriented interface to add
> data. The table structure (aka. schema) remains immutable once all
> columns have been added.
>
> To benefit from the heterogeneous nature of Fusion, I would consider a
> table row a fusion::vector, maybe created using fusion::vector_tie from
> some arbitrary data.
>
> At the very high level, I think of something along the lines of:
>
> <snip>
> As you can see (at the mark -->), I need to cross at some point the
> compile-time/runtime boundary but I am having trouble designing that
> interface. Perhaps boost::variant might help here to bound the potential
> number of types? Any kind of thoughts are appreciated.
>

Since the number of columns is determined at runtime, you can't really use
fusion. You're best bet is probably std::vector<boost::variant<...> >

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net