|
From: | John D Lamb |
Subject: | Re: [Help-gsl] Why are standard (*, +, etc) operators not overloaded for complex numbers in C++ |
Date: | Sun, 28 Jan 2018 18:01:11 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
On 27/01/18 19:38, Vincent Vandalon wrote:
Dear All, I am curious why the standard binary operators are not overloaded for the gsl_complex type in C++; I presume this overloading is omitted intentionally (since you can quickly write them yourself). Was the choice to omit overloaded operators mainly driven by the desire to avoid accidentally/non-explicit casting of a built-in type to gsl_complex?
Presumably because gsl is written in C.I don’t think C has a complex type. In any case the C++ complex type seems to be difficult to make compatible with the gsl representation while maintaining the original code in C.
I realise it is possible to do some sort of conversion/casting in C++. But this is not likely efficient.
-- John D Lamb
[Prev in Thread] | Current Thread | [Next in Thread] |