I need to define the return types (???? in code) after a sum with 2 parameters pack! My objective is to define a Tuple class (like std::tuple) and to implement for example here, the addition between two tuples of the same length and compatible type), here is a code snippet to understand :
template<class FirstType, class ... Types>
class Tuple{
....
template <typename ... OtherTypes>
const Tuple<????> operator+(Tuple<OtherTypes...>& other) const{...}
...
}
The problem is that "int + double" should return me a double for example! I looked on the std::common_type side, but I don't see either. A tuple is constructed as follows:
private:
FirstType m_first ;
Tuple<Types...> m_next ;
m_first contains the value, and, m_next contains the next tuple by removing a value.
This is my way of storing the different types although there is another way with a hereditary approach. I have another class with a template for the recursive case.
So I don't see how to get the final return type, I have a get function where I used a getHelper<...> structure to return the correct type but here it's different again. I don't want to use AUTO which can cause me problems and which is not magic.
Thank you in advance for your answers.
Example : Tuple<int,double>(3,4.4) + Tuple<double,double>(3.1,3.1) = Tuple<DOUBLE,DOUBLE>(6.5,7.5)