#include <condition_variable>
#include <iostream>
#include <mutex>
#include <thread>
 
int main(int, const char *[]) {
  std::mutex m;
  std::condition_variable cv;
 
 
  std::thread producer([&] {
    for (int i = 0; i < 32; ++i) {
      std::unique_lock<std::mutex> lk(m);
      cv.notify_one();
    }
  });
 
  std::thread consumer([&] {
    for (int i = 0; i < 32; ++i) {
      std::unique_lock<std::mutex> lk(m);
      cv.wait(lk, [&vec] { 
return !vec.
empty(); });
 
      std::cout << vec.
front() << std::endl;
 
    }
  });
 
  producer.join();
  consumer.join();
 
  return 0;
}
Implements a vector-like container that uses a linked list of fixed-size chunks to store its elements...
 
T & front()
Returns a reference to the first element in the container.
 
void pop_front()
Removes the first element from the container.
 
bool empty() const BOXES_NOTHROW
Returns true if the container is empty.
 
void push_back(Arg &&value)
Pushes a new element to the back of the container.
 
Implements a vector-like container that uses a linked list of fixed-size chunks to store its elements...