Producer consumer in C++11
Dead Lock Bug

If the queue is empty and the consumer thread is waiting in the condition variable. If you Queue goes out of scope the main thread will enter the detructor and perform join(). At this point you are locked. As both threads are waiting for the other.

Use of condition can be simplified.

    while(queue.empty())
    {
        cv.wait(lock);
    }


Can be replaced with:

    cv.wait(lock, [&amp;queue](){return !queue.empty();});


When poping things from a queue use move.

// this performs a copy.
int i = queue.front();

// this should move the value from the que.
int i = std::move(queue.front());


Note: It makes little difference for an integer but if there is an object in the queue then it might.

Formatting

Your code is horribly formatted. Please do a better job in the future. Formatting is a critical part of coding. This is because your code will be read fro decades aftr you have written it by other humans.