Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2004-07-25 20:36:48

Istvan Buki <istvan.buki_at_[hidden]> writes:

> Hello mpl experts,
> I'm trying to initialize the elements of an array using rules defined in a
> list of structures. The code below illustrate what I'm trying to achieve.
> The problem I have with this code is that the First_Descriptor structure
> contain this index member that will be used to access the right item of the
> array. This is not nice because it force the writer of this structure to deal
> with implementation details. Is there a way to get rid of this index typedef
> in the *_Descriptor structures by using another construct from the mpl that
> would generate it ?

The easiest thing to do is just to embed the index as a data member in
the Initializer object, which can be stateful. Just bump the index
each time the Initializer is invoked.


Dave Abrahams
Boost Consulting

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at