I read some discussions on the web and on this site, furthermore I didn't manage to understand my error. I've a particular queue called BlockingQueue with a template:
template <typename T, int size>
class BlockingQueue
{
public:
//constructor and other methods
void inserisci(T val) {
//do work
};
private:
queue <T> fifo;
atomic<boolean> isClosed;
mutex m;
};
In the main, I wrote the following lines:
BlockingQueue<int, 5> bq;
int k=8;
thread t(bq.inserisci, k);
t.join();
return 0;
While compiling, I obtain this error:
Error C3867: 'BlockingQueue::inserisci': function call missing argument list; use '&BlockingQueue::inserisci' to create a pointer to member
I read the suggestion of Visual Studio, so I tried to make a function pointer, but it not work the same. Any suggestion is appreciated.
Aucun commentaire:
Enregistrer un commentaire