MPL design question

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 others 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. -Jesse

AMDG Jesse Perla wrote:
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.
Boost.Parameter support this kind of usage. In any case, you probably need to use mpl::int_ instead of an integral constant. In Christ, Steven Watanabe
participants (2)
-
Jesse Perla
-
Steven Watanabe