加强与私有成员互斥奇怪的错误 [英] boost mutex strange error with private member

查看:134
本文介绍了加强与私有成员互斥奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的错误。

I have a strange error.

class INST
{
public:
boost::mutex m_mutex;
};

std::vector<INST> m_inst;

错误C2248:提高::互斥::互斥体:不能访问类中声明私有成员'的boost ::互斥体
看到的boost ::互斥::互斥体

error C2248: 'boost::mutex::mutex' : cannot access private member declared in class 'boost::mutex' see declaration of 'boost::mutex::mutex'

不过,我的另一个类是精细,

However, my other class is fine,

class VIEW
{
public:
boost::mutex m_mutex;
};

VIEW m_view;

我失去了一些东西在这里?我曾尝试申报m_mutex给私人,但仍然有同样的问题。

Am I missing something here? I have tried to declare m_mutex to private, but still have the same problem.

感谢。

推荐答案

互斥不能<一个href=\"http://www.boost.org/doc/libs/1_48_0/doc/html/thread/synchronization.html#thread.synchronization.mutex_types.mutex\">copied,所以你不能把它们放在这将复制互斥的容器。该错误很可能指的是互斥的私人拷贝构造函数。

mutexes can't be copied, so you can't place them in a container which would copy the mutex. The error is likely referring to the private copy constructor of the mutex.

这篇关于加强与私有成员互斥奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆