Q:

unique_ptr usage, getting from a collection

I just started using unique_ptr, I have a deque of std::unique_ptr :
typedef std::unique_ptr<Job> JobPtr;
typedef std::deque<JobPtr> JobDeque;

//Declaration in another class :
UserQueues::JobDeque _realTimeDeque;

In my code somewhere I want to get the last element of my Deque and so it returns a unique_ptr. I get the compiler complaining about copying the unique_ptr outright and if I use std::move I realize that I am transferring ownership from the Deque to my local unique_ptr named 'highestJob', which ends up giving a seg fault(I imagine the segfault comes from trying to print my Deque when the local unique_ptr got destroyed in the stack, and so the deque is holding garbage).
This is my current solution which works, but I was wondering what's the tidy way of grabbing a unique_ptr locally just so I can call some methods on the contained object while keeping ownership in my Deque.
    if(_realTimeDeque.size() > 0)
    {
       //I want a handle of the last element which is a unique_ptr :
       UserQueues::JobPtr *highestJob = &_realTimeDeque.back();

       (*highestJob)->decreaseExecTime();

       if((*highestJob)->execTimeZero())
       {
           _realTimeDeque.pop_back(); 
       }
    }

A:

How about this:
if (_realTimeDeque.size() > 0)
{
   _realTimeDeque.back()->decreaseExecTime();

    if (_realTimeDeque.back()->execTimeZero())
    {
        _realTimeDeque.pop_back(); 
    }
}

Alternatively, if you want to use a local variable:
if (_realTimeDeque.size() > 0)
{
   Job & job = *_realTimeDeque.back();

   job.decreaseExecTime();

    if (job.execTimeZero())
    {
        _realTimeDeque.pop_back(); 
    }
}

