[type_traits]interest in inclusion of aligned_types in type_traits?

Query: The code here: http://boost-consulting.com/vault/index.php?&directory=variadic_templates in: aligned_types.2.zip(tr1/aligned_types.hpp) would seem to fit best in boost's type_traits, in particular, with those templates described here: http://www.boost.org/doc/html/boost_typetraits/category.html#boost_typetrait... Is there any interest in adding the aligned_types code there? Brief Description: The aligned_types template declaration is: template<class Tag, typename... Types> struct aligned_types; where: Tag is the "layout tag". Currently the only such tags are: variant tuple packed Types is a sequence of types (much like the current variant and boost sequences) and where the resulting nested type: aligned_types<Tag,Types...>::type is simply an instance of aligned_storage with sufficient memory to accommodate Types... in a layout specificed by Tag. For example, with Tag==variant, the aligned_storage is the same as that for the aligned_union<0,Types...> of: http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2006/n2140.pdf The other tags are for regular structs(tag=tuple) and packed structs(tag=packed). WARNING-Needs Variadic Template Compiler: The code uses Gregor's variadic template compiler: http://www.osl.iu.edu/~dgregor/cpp/variadic-templates.html hence, it can't be used with any other compiler. However, I'd think it could be converted to use the preprocessor methods used by much of boost::mpl and boost::fusion to approximate Gregor's variadic templates. Applications: Reuse in boost::variant: Around line 215 of: http://boost.cvs.sourceforge.net/boost/boost/boost/variant/variant.hpp?revision=1.97&view=markup there's make_storage whose nested type, is, AFAICT, the same as aligned_types<variant,Types...>::type. The one difference is that make_storage (from looking just at lines 233-235) calculates the alignment of the variant and the max of the individual alignements. However, as explained in: aligned_types.2.zip(libs/tr1/doc/aligned_struct_offsets.txt) least-common-multiple instead of max is needed to handle extended alignments. Thus, aligned_types<variant,Types...> could be used in place of the current variant's make_storage. Space efficient tuple without preprocessor: By using aligned_types<tuple,Types...>::type as a storage buffer for a tuple, and using the mpl::at_c specializations in aligned_types.2.zip(tr1/aligned_types.hpp) to access the subparts of this storage buffer corresponding to an element in Types..., a tuple implementation as space efficient as fusion's could be achieved without use of the boost preprocessor library.
participants (1)
-
Larry Evans