VS2015 wont compile my code, says namespace "std" has no member "clamp", although intellisense picks it up just fine and tells me the parameters and return value. Yes, i have included the header.
#include <Math/Matrix3D.h>
#include <glm.hpp>
#include <gtx/transform.hpp>
#include <Utils/Clock.h>
#include <algorithm>
void somefunc()
{
viewPos.y = std::clamp(viewPos.y, -0.95f, 0.95f);
}
std::clamp in C++ 17Clamps a variable to a given range[high – low]. If num > high, num is assigned high. If num < low, num is assigned low. If num is already clamped, no modifications.
The clamp() function in C++ boost library is found under the header 'boost/algorithm/clamp.
You would have to use the /std:c++latest
switch to enable C++17 additions to the standard.
https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With