I have created this method to put some data in a buffer:
template <typename T>
void locked_buffer<T>::put(const T & x, bool last) noexcept
{
using namespace std;
unique_lock<mutex> l{mut_};
not_full_.wait(l, [this] { return !do_full(); });
buf_[next_write_] = item{last,x};
next_write_ = next_position(next_write_);
l.unlock();
not_empty_.notify_one();
}
But, trying to put data which consists in a return of a function:
int size_b;
locked_buffer<long buf1{size_b}>;
buf1.put(image, true); //image is the return of the function
I've got problems with the boolean variable bool last
because I've got compilation errors.
Thanks.
Edit: The error that I obtained is the following one:
error: no matching function for call to 'locked_buffer<long int>::put(std::vector<std::vector<unsigned char>>&, bool)'