嗨,我要通过c ++ boost库编写循环缓冲区.我提出了一些我无法理解的问题.
boost::lock_guard<boost::mutex> guard( Mutex );
boost::lock_guard<boost::mutex> lock( Mutex );
Run Code Online (Sandbox Code Playgroud)
这是我第一次使用boost库,所以我真的不明白这两者有什么区别.请帮我
嗨,我正在编写简单的类,然后是web中的示例代码.此代码工作正常,没有错误.
class Shape{
protected:
int width,height;
public:
Shape(int a = 0, int b=0)
{
width = a;
height = b;
}
};
class regSquare: public Shape{
public:
regSquare( int a=0, int b=0)
{
Shape(a, b);
}
};
Run Code Online (Sandbox Code Playgroud)
但是当我改变我的只有一个参数的构造函数,如
class Shape{
protected:
int width;
public:
Shape(int a = 0)
{
width = a;
}
};
class regSquare: public Shape{
public:
regSquare(int a = 0)
{
Shape(a);
}
};
Run Code Online (Sandbox Code Playgroud)
这种按摩发生了错误
'错误:'a'声明参数的声明'
我不知道我的代码有什么问题