命名空间"std"没有成员"clamp"

jeo*_*ohd 7 c++ std

VS2015不会编译我的代码,名称空间"std"没有成员"clamp",虽然intellisense选择它很好并且告诉我参数和返回值.是的,我已经包含了标题.

#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);
}
Run Code Online (Sandbox Code Playgroud)

Bo *_*son 5

您必须使用该/std:c++latest开关来启用 C++17 对标准的添加。

https://blogs.msdn.microsoft.com/vcblog/2016/06/07/standards-version-switches-in-the-compiler/