
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: template <typename T> struct column { void write(const T& x) { // Store x in some fashion (memory or disk). } }; struct table { --> fusion::vector<???> cols; template <typename C> void add_column(C* c) { fusion::push_back(cols, c); } template<typename R> void write(const R& row) { // Writer simply calls c->write(x). fusion::for_each(fusion::zip(row, cols), writer()); } }; int main() { table t; ... auto* ic = new column<int>(); auto* dc = new column<double>(); t.add_column(ic); t.add_column(dc); ... } 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. Matthias -- Matthias Vallentin vallentin@icsi.berkeley.edu http://www.icir.org/matthias