I created a threadsafe circular buffer containing shared_ptrs to openCV matrices in the following manner. I get compilation errors when I try to passing a dereferenced shared_ptr to a function that takes a constant reference.
threadsafe_circular_buffer<std::shared_ptr<cv::Mat> > buf;
std::shared_ptr<cv::Mat> ptr(buf.pop());
foo(*ptr);
where pop is defined as
template <typename T>
T threadsafe_circular_buffer::pop();
and foo is defined like
bool foo(const cv::Mat &matrix);
I get the following error:
invalid initialization of reference of type 'const cv::Mat&' from expression of type 'std::shared_ptr<cv::Mat>'
How do I deref the shared_ptr so I can pass a reference to the underlying object.
Aucun commentaire:
Enregistrer un commentaire