
2015-06-04 0:48 GMT+02:00 Evgeny Panasyuk <evgeny.panasyuk@gmail.com>:
03.06.2015 23:42, Andrzej Krzemienski:
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?
For example, It can be used as fast drop-in replacement for std::vector<boost::variant<Types...>> in case when order of elements (across different types) is not important. For instance CAD application may want to process all objects, like draw all of them or apply some filter or serialize. There is no need to pay cost of dynamic dispatch on each element.
A replacement for std::vector<boost::variant<Types...>> in order to get performance -- agreed. Not a "drop-in" one though, I think, because If I change the type, I need to go and change every place that is using it, right? And if I am forced to restructure my code, why would I not just use: struct variantvector { std::vector<T1> t1; std::vector<T2> t2; }; ? In other words, I am not questioning the idea of the optimization, but the usefulness of the library. My understanding (as of now) is that compared to a hand-crafted solution it offers (1) different names for the sub-containers, and (2) a function that returns the sum of sizes of individual containers. Regards, &rzej
By the way, https://akrzemi1.wordpress.com/2013/12/11/type-erasure-part-iii/#comment-175...
Best Regards, Evgeny Panasyuk
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost