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);
}
std::clamp
看起来是 C++17 专属的。你的编译器标志是否设置为编译 C++17? - Kevinstd::clamp
。 - ShadowRanger