Help testing release candidate for std::complex

One thought. It may be possible to limit the impact to the rest of the code base, for example the problems where the introduction of the new functions causes ambiguity errors with old functions such as pow(var,int) from the previous thread. This could be done by adding a default parameter to the templates of your new functions that automatically fails instantiation when substituted with a non-complex type. In other words, SFINAE to remove the new functions from the potential overload set of the non-complex stan functions. Then most of the new complex handling functions could be kept at the prim level, and the only forward declarations would be used to declare the types that the SFINAE test uses to check if it has complex template parameters. Here is an example from my implementation. The example permalink calls out to a specific line because the rest of the file is made more convoluted because of the differences between gcc’s libstdc++ and clang’s libc++.

1 Like