Boost logo

Boost :

From: Eric Friedman (ebf_at_[hidden])
Date: 2003-04-05 22:24:00

Gennadiy Rozental wrote:
> 1. There is "theoretical" limits for the size of MPL sequences. See MPL
> 2. You could limit variant support only for lists that does not exceed

Not true. There is absolutely no limit on the size of a type-sequence (other
than memory available to compiler, etc.).

You are misinterpreting BOOST_MPL_LIMIT_LIST_SIZE and, likewise,
BOOST_VARIANT_LIMIT_TYPES. These preprocessor #defines relate to the number
of template arguments accepted. That is, if BOOST_MPL_LIMIT_LIST_SIZE were
4, then mpl::list would be defined as mpl::list<T1 = void_, T2 = void_, T3 =
void_, T4 = void_>. This has absolutely nothing to do with any upper limit
on the length of type-sequence.

For instance, consider the following (again, assume

  typedef mpl::list<int, short, float, double> types;

  typedef mpl::push_back<types, char> more_types;
  BOOST_STATIC_ASSERT( mpl::size<more_types>::value == 5 );

So there is no inherent maximum number of types imposed on us. So you
propose an arbitrary limit:

> 3. You could choose/define any other arbitrary limit (it should probably
> exceed limits mentioned in items 1 and 2)

I just think this is a bad idea. Loop-unrolling would provide O(1)
complexity for some implementation-defined number of types and would not
place any arbitrary limits on the user.

 - Eric

Boost list run by bdawes at, gregod at, cpdaniel at, john at