A
Alexander Stippler
Hi,
simple question. Why does this not work:
#include <algorithm>
#include <cmath>
#include <iostream>
int
main()
{
double a[2];
a[0] = 0;a[1] = M_PI/2.;
std::transform(a, a+2, a, std::sin);
std::cout << a[0] << ", " << a[1] << std::endl;
return 0;
}
for gcc and icc the type of the third argument of transform is unknown. If I
use the global ::sin it works fine. Why? I include cmath and there sin is
defined in namespace std, so why is it unknown?
regards,
alex
simple question. Why does this not work:
#include <algorithm>
#include <cmath>
#include <iostream>
int
main()
{
double a[2];
a[0] = 0;a[1] = M_PI/2.;
std::transform(a, a+2, a, std::sin);
std::cout << a[0] << ", " << a[1] << std::endl;
return 0;
}
for gcc and icc the type of the third argument of transform is unknown. If I
use the global ::sin it works fine. Why? I include cmath and there sin is
defined in namespace std, so why is it unknown?
regards,
alex