Access to maths special functions c++17

Hi all,


I have been trying lately to use some specific functions that are in the C++17 standard. However with the clang that ships with xcode 10.2, I cannot find those functions. They are however included in clang 6.0 on linux. Is there any reason I don't find it on a mac ?


The example is that one (from here: https://en.cppreference.com/w/cpp/numeric/special_math/legendre) :


#include <cmath>

#include <iostream>

double P3(double x) { return 0.5*(5*std::pow(x,3) - 3*x); }

double P4(double x) { return 0.125*(35*std::pow(x,4)-30*x*x+3); }

int main()

{

// spot-checks

std::cout << std::legendre(3, 0.25) << '=' << P3(0.25) << '\n'

<< std::legendre(4, 0.25) << '=' << P4(0.25) << '\n';

}


Compiled with clang++ -std=c++17 test.cxx . Any help or info would be appreciated


Thanks

Replies

The reason should be obvious. Apple lags behind on such things. Supposedly this function is available in boost.

Not just Apple. I just updated clang/llvm/libcxx from the master repository and it's not in there. Nor is it in math.h (for master), which is the actual implementation (cmath includes math.h, and includes the math function names in the std namespace).

Thanks for the answers. That's what I guessed as well. Any idea on when this would be supported ?


That being said, clang 6.0 on linux has the small example working, so I'm not sure where the problem resides.