P
Patrick Kowalzick
Dear all,
I have a question about default template parameters.
I want to have a second template parameter which as a default parameter,
but depends on the first one (see below). Is something like that possible?
Some workaround?
Thank you,
Patrick
// Definitions
template <typename T1=int,typename T2=int> class foo;
// this is not working (sure):
template <double, typename T2=double> class foo;
// Implementation
template <typename T1,typename T2> class foo{};
int main()
{
foo<> a1; // foo class <int,int>
foo<int> a2; // foo class <int,int>
foo<float> a3; // foo class <float,int>
foo<float,float> c; // foo class <float,float>
// BUT this should be defined via second definition:
foo<double> b; // foo class <double,double>
return 0;
}
I have a question about default template parameters.
I want to have a second template parameter which as a default parameter,
but depends on the first one (see below). Is something like that possible?
Some workaround?
Thank you,
Patrick
// Definitions
template <typename T1=int,typename T2=int> class foo;
// this is not working (sure):
template <double, typename T2=double> class foo;
// Implementation
template <typename T1,typename T2> class foo{};
int main()
{
foo<> a1; // foo class <int,int>
foo<int> a2; // foo class <int,int>
foo<float> a3; // foo class <float,int>
foo<float,float> c; // foo class <float,float>
// BUT this should be defined via second definition:
foo<double> b; // foo class <double,double>
return 0;
}