
On 08/31/10 16:01, Cory Nelson wrote:
Hello,
Is there a compressed fusion::vector that minimizes the size if the types passed in are empty, like compressed_pair? Thanks!
I know of none; however, using the empty-base-class-optimization (EBO): http://www.cantrip.org/emptyopt.html I'd guess that the method that inherits a "tagged" element for each element in the tuple would avoid occupying any memory for empty elements. A tagged element is one that is tagged with the element index, as shown here: https://svn.boost.org/trac/boost/browser/sandbox/variadic_templates/libs/mpl... The tag is used to access that particular element. Further explanations are in the reference found in the in-source comments to tuple_non_recur.package_range_c.cpp. I thought Christopher Schmidt's variadic fusion had a similar implementation. I think it involves use of: http://svn.boost.org/svn/boost/sandbox/SOC/2009/fusion/boost/fusion/containe... However, after several minutes of greping and searching, now I can't detect where it's used like that shown in: tuple_non_recur.package_range_c.cpp. I know several months ago there was a benchmark comparison done that's reported in the thread containing this post: http://article.gmane.org/gmane.comp.lib.boost.devel/194407 That comparison showed the tagged element implementation was slower; however, as I said, it may save some space in case the compiler implements EBO. HTH. -Larry