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:
typedef struct {
PmMessage message;
PmTimestamp timestamp;
} PmEvent;
PmTimestamp and PmMessage are defined as:
typedef int32_t PmMessage/PmTimeStamp;
any help appreciated.
Cheers
Sean.
--begin code—
#include <queue>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
template <typename Data>
class concurrent_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--