Hi,
On 02/23/2014 04:11 PM, Marc Glisse wrote:
On Sun, 23 Feb 2014, Paolo Carlini wrote:
On 02/23/2014 11:32 AM, Marc Glisse wrote:
Hello,
looking at this question:
http://stackoverflow.com/q/21737186/1918193
I was surprised to see that libstdc++'s std::complex basically just
works with user-defined types, even weird expression template ones,
although that's not a supported use afaik.
The only functions that fail seem to be exp and pow, both because
they call polar with two arguments that have different (expression)
types.
I am not proposing to make this a supported use, but the cost of
this small patch seems very low, and if it makes a couple users
happy...
Regtested with no problem on x86_64-linux-gnu, ok for stage 1?
I would even be in favor of applying it now. Can we figure out simple
(ie, not relying on boost...) testcases too?
I didn't try std::complex<std::valarray<X>>, maybe...
Otherwise, you need a type T with all the (real) math functions
defined, and where every operation returns a different type
(implicitly convertible to T). And then you want to call all the
complex functions.
That seems doable, but way bigger than I'm willing to go for this
feature. If you want to take over, be my guest ;-)
Another option would be just using boost/multiprecision/mpfr.hpp when
available. In general, I think it makes sense to have a minimum of
infrastructure enabling tests checking interoperability with boost. If
only we had a check_v3_target_header { args } it would be most of it,
but it doesn't seem we do?!? Anyway I guess we can take care of that
post 4.9.0 and commit the straightforward code tweak now. Jon?
Paolo.
PS: Resending message, yesterday had issues with html