Skip to content

Commit 6b5eddd

Browse files
committed
proxy to ::sqrt from squareRoot (for template argument processing on solaris)
1 parent 11fc9e0 commit 6b5eddd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

inst/tests/cpp/transform.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ using namespace Rcpp;
1010
#include <cmath>
1111
#include <algorithm>
1212

13+
double squareRoot(double x) {
14+
return ::sqrt(x);
15+
}
16+
1317
// [[Rcpp::export]]
1418
NumericMatrix matrixSqrt(NumericMatrix orig) {
1519

1620
// allocate the matrix we will return
1721
NumericMatrix mat(orig.nrow(), orig.ncol());
1822

1923
// transform it
20-
std::transform(orig.begin(), orig.end(), mat.begin(), ::sqrt);
24+
std::transform(orig.begin(), orig.end(), mat.begin(), squareRoot);
2125

2226
// return the new matrix
2327
return mat;
@@ -43,7 +47,7 @@ struct SquareRoot : public Worker
4347
std::transform(input.begin() + begin,
4448
input.begin() + end,
4549
output.begin() + begin,
46-
::sqrt);
50+
squareRoot);
4751
}
4852
};
4953

0 commit comments

Comments
 (0)