composite_storage/{one_of, all_of} replace {vector, variant} -> space savings

Larry Evans <[email protected]> Fri, 24 Sep 2010 14:26:57 -0500
Newsgroups gmane.comp.parsers.spirit.devel
Message-ID <[email protected]>
FYI, output of:

> https://svn.boost.org/trac/boost/browser/sandbox/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.cpp

is attached.  It shows some space advantages over
aggregation(the empties_member struct, which is
like fusion::vector), inheritance (the empties_tree_inherit),
and boost::variant(corresponding to the one_of_maybe).

These might be useful replacements for fusion::vector
and boost::variant if your space constrained.
Of course you pay for the space saving with
compile time (I've no idea how badly).

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev

_______________________________________________
Spirit-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-devel
empty_base.compilation (text/plain, 2.7 KB)
-*- mode: compilation; default-directory: "~/prog_dev/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/" -*-
Compilation started at Fri Sep 24 14:05:26

make run
install -d `dirname /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.o`
/home/evansl/download/gcc/4.5.1-release/install/bin/g++ -c -ftemplate-depth-300 -O3 -fstrict-aliasing -Wstrict-aliasing=3 -std=gnu++0x -DCXX0X_VARIADIC_TEMPLATES -DBOOST_USE_MPL_VARIADIC_TEMPLATES -I/home/evansl/prog_dev/boost-svn/ro/sandbox/rw/variadic_templates -I/home/evansl/prog_dev/boost-svn/ro/sandbox/ro/switch -I/home/evansl/prog_dev/boost-svn/ro/trunk  -DTEMPLATE_DEPTH=300  empty_base.cpp -MMD -o /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.o 
sed -e 's#^empty_base.o:#/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.o:#' /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.d> /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.o.dep
#rm /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.d
/home/evansl/download/gcc/4.5.1-release/install/bin/g++ -Wl,-rpath /home/evansl/download/gcc/4.5.1-release/install/lib64  /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.o -o /home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.exe
/home/evansl/prog_dev/boost-svn/ro/trunk/sandbox-local/build/gcc4_5_1v/boost-svn/ro/sandbox/rw/variadic_templates/libs/composite_storage/sandbox/pack/empty_base.exe 
sizeof(empty_class<0>)=1
sizeof(empties_inherit)=1
sizeof(empties_tree_inherit)=2
sizeof(empties_member)=2
sizeof(empties_all_of)=1
sizeof(empties_tree_all_of)=1
sizeof(empties_one_of)=4
sizeof(empties_variant)=8
sizeof(enum_base<index0>::type)=4
p0=0x7fffa0fdc69f
p1=0x7fffa0fdc69f
*p0=empty_class<0>const&
*p1=empty_class<1>const&
r0=empty_class<0>const&
r1=empty_class<1>const&
&ea_v=0x7fffa0fdc69e
&r0=0x7fffa0fdc69e
&r1=0x7fffa0fdc69e
r1.get()=1

Compilation finished at Fri Sep 24 14:05:29