multiple default template argument cases that depend on a template argument respectively

I would like to define two particular default cases for a template class A. Is something similar possible?: template<typename T1, typename T2> class A{ // … }; struct X; // if necessary, I can also define X right here. template<> A<X> = A<X,int>; template<typename T> A<T> = A<T,T>; int main(){ A<X> a; // shall construct… Read More multiple default template argument cases that depend on a template argument respectively

How to make C++ template type to default to previous template type

Is there any way, to default second template type to the type of the first template argument type, to remove the need of specifying the template types when not needed? So, I have a method, that pops values from byte array: template<class TYPE1, class TYPE2> bool pop_value_from_array(TYPE2 &value) { if(get_array_size() >= sizeof(TYPE1)) { value =… Read More How to make C++ template type to default to previous template type