Dans le code:Comment passer des arguments au constructeur d'une politique?
template<class T>
struct FactorPolicy
{
T factor_;
FactorPolicy(T value):factor_(value)
{
}
};
template<class T, template<class> class Policy = FactorPolicy>
struct Map
{
};
int _tmain(int argc, _TCHAR* argv[])
{
Map<int,FactorPolicy> m;//in here I would like to pass a double value to a
//FactorPolicy but I do not know how.
return 0;
}
Edité [Mark H]
template<class T, template<class> class Policy = FactorPolicy>
struct Map : Policy<double>
{
Map(double value):Policy<double>(value)
{
}
};
Pourquoi le voulez-vous? –
@Alexey si vous regardez il y a un arg de cteur du FactorPolicy être passé et je voudrais pouvoir transmettre cette valeur en déclarant la variable carte. Quelque chose comme ceci: Carte –