Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-05-01 14:37:08


On Thu, May 1, 2008 at 8:06 PM, Hicham Mouline <hicham_at_[hidden]> wrote:

> hello,
> as i don't immediately see an MPL equivalent of multimap, here is what i
> am trying to achieve.
>
> I have a number of models (200 types, all of them inherit from 1 base
> class)
> and a number of contracts(400 types, also all them inherit from 1 base
> class),
> and I try to write a test suite for valid combinations.
> Was there a multimap in MPL, i would have stored this matrix:
> model1 contract1, contract17, contract156
> model2 contract17
> ...
> model200 contract23
>
> or symetrically, indexed by contract
> in a multimap.
>
> Are there solutions with other MPL sequences?
>
> Rds,
>
I am not sure I understand you. But if you mean to test all models against
all contracts you can use 2 mpl::vectors with 2 nested mpl::for_each loops.
http://www.boost.org/doc/libs/1_35_0/libs/mpl/doc/refmanual/for-each.html

The first mpl::for_each picks from the model vector a type and passes it to
a test suite, the other mpl::for_each iterates through the contract vector
and calls a corresponding test function for the model and contract.

And one more thing:
mpl::vector is by default limited by 20 entries. Please read here how to
increase this limit
http://www.boost.org/doc/libs/1_35_0/libs/mpl/doc/refmanual/limit-vector-size.html

Regards,
Ovanes



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net