I need to adapt the template of two parameters to the template of one parameter.
I would like to bind the first template parameter:
template<class T1, class T2>
struct Two_Parameter_Template {
Two_Parameter_Template() { };
template<class Param>
Two_Parameter_Template(Param) { }
};
using the antoher (non intrusive) template mechanism:
template<class X, template<class, class> class bound>
struct bind_1st {
template<class T> // this is the resulting one parameter template
struct eval {
eval () {
bound<X, T>();
}
template<class T2>
eval (T2 obj) {
bound<X, T>(obj);
}
};
};
So that I can use this template later, as a parameter for another template, with one smaller parameter (something like below):
template <template<class> class One_Parameter_Template>
struct SomeTemplate {
};
typedef SomeTemplate<bind_1st<Bound_Param_class, Two_Parameter_Template> >::eval ConcreteClass;
Question: is there any syntax in C ++ to support this.
Best regards,
Marcin
source
share