The question is if I can find a way to make a parametrized overloading of an operator i.e. instead of
template <class T>
class A
{
private:
T m_var;
public:
operator T () const { return m_var; }
const A operator+ ( const A& r_var ) const { return m_var + r_var; }
const A operator- ( const A& r_var ) const { return m_var - r_var; }
const A operator* ( const A& r_var ) const { return m_var * r_var; }
const A operator/ ( const A& r_var ) const { return m_var / r_var; }
...........
}
to have something like this
template <class T>
class A
{
private:
T m_var;
public:
operator T () const { return m_var; }
const A operator 'X' ( const A& r_var ) const { return m_var 'X' r_var; }
...........
}
where 'X' will take values +, -, *, /, and in this way to avoid repetition of the same pattern code. Thanks in advance.