Boost logo

Boost :

From: christopher diggins (cdiggins_at_[hidden])
Date: 2005-01-04 13:52:55


I have written a union-style type similar to boost::variant which allows
single values, and multiple types. This type is called a union-list ( ul )
and is described at http://www.codeproject.com/useritems/union_list.asp

I will be honest, there are several disadvantages of the union-list when
compared to boost::variant

1. Declaration style is uglier :

typdef ul<int, ul<char, ul<float, ul<string, ul_end> > > > my_union_list;

2. the data size is huge = summation of the size of the individual types
plus sizeof(bool) * #types.

3. union-list has very few features

The advantages (and my motivation for creating it) of the union-list is that
it requires no other boost libraries and has a very tiny code base. Another
difference ( but not neccessarily an advantage ) of the union-list is that
it uses and provides an index to access the type of its contents.

I don't know if this is sufficient to warrant eventual submission as a boost
mini-library. Any comments?

In general I am curious about how other boosters feel about boost library
sizes and inter-library couplings. For me this is a big obstacle to using
boost in many circumstances. It doesn't seem to be a concern at all for the
boost community, but I wonder if other programmers have similar sentiments
and find themselves often seeking out simpler alternatives.

Christopher Diggins
http://www.cdiggins.com
http://www.heron-language.com


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk