this blog下面有一个命令:
class BoundedFloat
{
public:
BoundedFloat(const float v) : Value(v) {}
// some common methods that use Min and Max
// prefer to implement in base class rather than in each derived class
bool withinBounds();
bool breachedLowerThreshold();
bool breachedUupperThreshold();
protected:
const float Min;
const float Max;
float Value;
}
bool BoundedFloat::withinBounds()
{
return ((Value >= Min) && (Value<= Max));
}
bool BoundedFloat::breachedLowerThreshold()
{
return (Value < Min);
}
bool BoundedFloat::breachedUupperThreshold()
{
return (Value > Max);
}
class Temperature : public BoundedFloat
{
public:
Temperature(const float v) : BoundedFloat(v) {}
// seems wasteful to do this each time, when min and max only need
// initialised once per derived class
// Temperature(const float v) : BoundedFloat(v, -40.0f, 80.0f)
// statically initialise Temperature's Min and Max in base class here somehow?
private:
// I know this is wrong, but it indicates the functionality I'm looking for.
override static float Min;
override static float Max;
}
运行此代码时,发生错误:
net::io_context ioc;
auto endpoint = ip::basic_endpoint<ip::tcp>
(ip::address_v4::loopback(), port_num);
auto socket = ip::tcp::acceptor(ioc, ip::tcp::v4());
std::error_code ec;
socket.bind(endpoint);
socket.listen();
auto ct = ioc.poll_one();
auto tcp_socket = socket.accept();
我搜索了此usedata('gpa')
函数,但找不到。
另外,我尝试了Error: could not find function "usedata"
,但仍然无法加载此数据。