Thanks for the clarification. What you’re looking for is something called argument dependent lookup (link to cppreference).
From the original example, it would work if you did this:
namespace stan {
namespace math {
template <typename T>
T test(const T& x) {
using std::fabs;
return fabs(x);
}
}
}
Edit: this is not true. Please read the next comment for an explanation. If you were outside the stan::math::
namespace, you’d also want to add a using stan::math::fabs;
. ADL will help choose the right function call for you since you put in the using statements.
It’s working for exp
because I bet there’s an exp
in the global namespace that’s brought in using one of your includes.