En prenant l'exemple suivant, je me demande s'il existe une alternative à boost::mpl::for_each
, qui appelle un Functor sans aucun argument.boost :: mpl :: for_each sans instanciation
#include <boost/mpl/vector.hpp>
#include <boost/mpl/for_each.hpp>
struct EasyFixEngineA { static const char* const name() { return "a"; } };
struct EasyFixEngineB { static const char* const name() { return "b"; } };
struct Registrator {
// Would prefer a template<class T> void operator()()
template<class T> void operator()(T t) {
RegisterInFactory<EasyFixEngine, T> dummy(T::name());
}
};
// ...
typedef boost::mpl::vector<EasyFixEngineA,EasyFixEngineB> Engines;
boost::mpl::for_each<Engines>(Registrator());
Il semble que for_each
est par défaut-instancier les types.
Merci, fonctionne comme un charme :) – abergmeier