diff --git a/src/celmath/mathlib.h b/src/celmath/mathlib.h index a1f73d5c..2a2cc3d4 100644 --- a/src/celmath/mathlib.h +++ b/src/celmath/mathlib.h @@ -49,11 +49,13 @@ template constexpr T clamp(T t) return (t < 0) ? 0 : ((t > 1) ? 1 : t); } +#if __cplusplus < 201703L // return t clamped to [low, high] template constexpr T clamp(T t, T low, T high) { return (t < low) ? low : ((t > high) ? high : t); } +#endif template inline constexpr T degToRad(T d) { @@ -151,4 +153,11 @@ ellipsoidTangent(const Eigen::Matrix& recipSemiAxes, return e + v * t1; } }; // namespace celmath + +#if __cplusplus < 201703L +namespace std +{ + using celmath::clamp; +}; +#endif #endif // _MATHLIB_H_