Boost logo

Boost Users :

Subject: [Boost-users] MPL design question
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2009-03-10 20:42:20

I have a class that is getting a huge number of template parameters (mostly
a bunch of size_t used for vector sizes). They have a natural organization
into groups, but almost all of them have a default as 0.

How do you suggest that I design the template parameter for this? Is there
any way to use some kind of associative container so I could look these up
by "name" and default to 0 if they aren't there? I can't see how to use
mpl::map to do this kind of stuff.

Simplified Pseudocode:

What I have:
template<std::size_t IndividualSize = 0, std::size_t AggregateSize> //Many
class my_problem{...};

What I want:
template<class StateSizes> class MyProblem{...}

Called something like:
typedef my_problem<map<AggregateSize, 2> > my_problem_type;
where AggregateSize is an enum, placeholder struct, etc. And in this case I
would default IndividualSize to 0.


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