Salve,
ho una domanda sui template di c++, relativamente ad una funzione che mi trovo a gestire:
template<class TPRic, class T>
bool confronta(TPRic& a, T& b, T& c){
if(a=='1' || a=='3') return (b<= c);
if(a=='2' || a=='4') return (b>= c);
else return false;
}
Come faccio a sapere che tipo è a run-time il parametro "tipoRicerca"?
Infatti se è un char, va bene l'if che c'è, me se è un int come faccio a saperlo?
Esiste un modo + pulito per impostare la funzione, usando i template?
Grazie.