-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[math] TComplex arithmetic operators don't work with integral types #13730
Comments
I confirm. On Mac we get:
|
For my own curiosity, what is the advantage of using |
Generalize the arithmetic operator overloads of TComplex to general arithmetic types with templates. Closes root-project#13730.
Probably compatibility with other ROOT interfaces. But indeed I don't think we need to support this |
Generalize the arithmetic operator overloads of TComplex to general arithmetic types with templates. I'm using some `enable_if` for arithmetic types only, so we can be sure that nothing unexpected will happen for non-arithmetic types that implement arithmetic operators with `double` themselves. Closes root-project#13730.
Thank you I will follow your thread. |
You're welcome! Let's keep this issue open as long as the PR is not merged though :) |
Alternatively and / or additionally it might make a lot of sense to remove the lines
and keep only the conversion to double. |
I agree that this should be considered in the future. Implicit type conversions always come back to bite you at some point and should be forbidden 🙂 |
Generalize the arithmetic operator overloads of TComplex to general arithmetic types with templates. I'm using some `enable_if` for arithmetic types only, so we can be sure that nothing unexpected will happen for non-arithmetic types that implement arithmetic operators with `double` themselves. Closes #13730.
Generalize the arithmetic operator overloads of TComplex to general arithmetic types with templates. I'm using some `enable_if` for arithmetic types only, so we can be sure that nothing unexpected will happen for non-arithmetic types that implement arithmetic operators with `double` themselves. Closes root-project#13730.
Feature description
Hello,
This sounds obvious but, can we hope to have some cast compatibility with int and float for TComplex class ?
Just typing the following line is failing:
2*TComplex(2,2)
but
2.0*TComplex(2,2)
is fine.I dont think this would be a lot of work, but very helpful to use.
Cheers,
M.
The text was updated successfully, but these errors were encountered: