
Ok, I analyzed your problem once again. It seems you're trying to make a copy of 'concurrent_queue<Data>' somewhere in your code: -- This diagnostic occurred in the compiler generated function
'concurrent_queue<Data>::concurrent_queue(concurrent_queue<Data> &)') --
you can see the copy constructor called. the problem is that boost::mutex and boost::condition_variable are instances of boost::noncopyable (copy constructor and assignment operator are private to prevent from copying objects). you have two options: 1) prevent copying 'concurrent_queue' objects 2) implement copy constructor in 'concurrent_queue' to initialize 'the_mutex' and 'the_condition_variable' using their default constructors WBR, Adam Romanek On 07/20/2011 09:21 AM, Sean Farrow wrote:
Hi:
I’m using a queue written I think as I remember by Antony Williams (sorry if this is incorrect but it was certainly someone in the uk).
The code is below, I’m getting 2 c2248 errors indicated by visual c++ 2010 at the last line of the class i.e the line with };
Does anyone know what’s causing this?
The errors are:
1>d:\dropbox\mackie display reader\surface reader\surface reader\queue.hpp(18): error C2248: 'boost::mutex::mutex' : cannot access private member declared in class 'boost::mutex'
c:\program files\boost\boost\thread\win32\mutex.hpp(26) : see declaration of 'boost::mutex::mutex'
c:\program files\boost\boost\thread\win32\mutex.hpp(22) : see declaration of 'boost::mutex'
This diagnostic occurred in the compiler generated function 'concurrent_queue<Data>::concurrent_queue(concurrent_queue<Data> &)'
with
[
Data=PmEvent
]
1>d:\dropbox\mackie display reader\surface reader\surface reader\queue.hpp(18): error C2248: 'boost::condition_variable::condition_variable' : cannot access private member declared in class 'boost::condition_variable'
c:\program files\boost\boost\thread\win32\condition_variable.hpp(299) : see declaration of 'boost::condition_variable::condition_variable'
c:\program files\boost\boost\thread\win32\condition_variable.hpp(295) : see declaration of 'boost::condition_variable'
This diagnostic occurred in the compiler generated function 'concurrent_queue<Data>::concurrent_queue(concurrent_queue<Data> &)'
with
[
Data=PmEvent
]
PmEvent is just a standard c structure:
typedefstruct {
PmMessage message;
PmTimestamp timestamp;
} PmEvent;
PmTimestamp and PmMessage are defined as:
typedefint32_t PmMessage/PmTimeStamp;
any help appreciated.
Cheers
Sean.
--begin code—
#include<queue>
#include
#include
template<typename Data>
classconcurrent_queue {
private:
boost::mutex the_mutex;
boost::condition_variable the_condition_variable;
std::queue<Data> the_data;
public:
void push(Data const& data)
{
boost::mutex::scoped_lock lock(the_mutex);
the_queue.push(data);
lock.unlock();
the_condition_variable.notify_one();
}
};
--end code--
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users