Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 hours ago.
I'm trying to use clamp, but can't find it
A summary example
File: test.h
#ifndef DEMO_H
#define DEMO_H
#include <algorithm>
namespace demo {
typedef float real_t;
class test {
public:
void start();
real_t x = 10.90;
real_t y = 2.10;
test();
~test();
};
}
#endif //DEMO_H
File: test.cpp
#include "test.h"
using namespace demo;
void test::start() {
const int& p = std::clamp(x, 0, y);
}
VSC error, compile using scons:
no overloaded function instance "std :: clamp" matches the argument list - argument types are: (real_t, int, real_t)
Thanks a lot!
Please login or Register to submit your answer