Conversion constructor for template class
Real numbers become complex numbers when the second argument of an operator+, or the argument of an operator +=, is a complex number.
I have made a type 'Real' as a typedef of 'double', and a type 'Complex' as a class (with all necessary operators). 'Complex' has a one-argument constructor with 'Real', but now I would like to have an operator+, or operator+=, for my 'Real' which converts the real number in a complex number.
Should I make a separate class 'Real' ? I think that this will have a huge impact on performance, since now all my variables will no longer be written directly on the stack, as is the case (if I'm correct) with the primitive types in C++.
Thanks for any help!