mercredi 21 novembre 2018

How to expand the content of an mpl::set as template parameters of a function template

I have a function template with a variadic number of template parameters:

template <typename T1, typename... Ts>
void doSomething()
{
    ...
}

Furthermore I have an mpl set defined as follows:

template <typename... Ts>
struct MyContainerCreator
{
    using type = boost::mpl::set<Ts...>;
};

using MyContainer= MyContainerCreator<T1, T2>;

Now I want to write a function doSomethingForAll() that calls doSomething() with the types in the mpl set as template parameters. Something like:

void doSomethingForAll()
{
    //pseudocode:
    doSomething<expandTypesToTemplateParameters<MyContainer::type>>();
}

Is this possible?

Aucun commentaire:

Enregistrer un commentaire