Compute  Legendre quadrature in C++