mercredi 16 février 2022

How can I declare my return type from generic function in generic class

I have generic class in c++

template<typename A>
struct  series { 

A member;
}

template<typename A,typename B,typename C>
series <C> & operator + (A first, const B& second) {
return first+second;
}

I need to return type that is implicit conversion of type A and type B. Fox example : double a + int b → implicit conversion is double how can I do that, because C cannot be determined like this I was trying something with decltype and typedef but it didn't work Thanks in advance

Aucun commentaire:

Enregistrer un commentaire