I have a class that requires a boost::variant containing shared pointers to various types as follows:
template <typename ToySharedPtrVariant, typename ColorSharedPtrVariant>
class ToyPicker {
typedef std::pair<
ToySharedPtrVariant,
ColorSharedPtrVariant
> toyAndColorPair;
typedef std::map<
std::string,
std::vector<
toyAndColoPair
>
> stringToToyColorPairMap;
// ... methods that use the defined types...
}
This class currently requires template parameters of the following form to compile:
ToyPicker<
boost::variant<
boost::shared_ptr<ToyModel>
>,
boost::variant<
boost::shared_ptr<BlueToy>,
boost::shared_ptr<RedToy>,
boost::shared_ptr<GreenToy>
>
> toyPicker;
How do I use an mpl list so that I can allow the following much simpler definition for users, then convert it into the one above inside my class?
ToyPicker<
boost::mpl::list<
ToyModel
>,
boost::mpl::list<
BlueToy,
RedToy,
GreenToy
>
> toyPicker;
I really appreciate all of the user help you all give, and hope that as I become more experienced I may be able to contribute myself.