title: Turning this raw pointer situation into a unique_ptr?
body: <p>I have code that looks like this:       </p>
  
  <pre><code>ISessionUpdater* updater = nullptr;
  if (eventName == "test")
      updater = new TestJSONSessionUpdater(doc);
  if (eventName == "plus")
      updater = new PlusJSONSessionUpdater(doc);
  
  if (updater)
  {
      bool result = updater-&gt;update(data);
      delete updater;
      return result;
  }
  return false;
  </code></pre>
  
  <p>Is there any way to do something like this but with <code>unique_ptr</code>?</p>
  
  <p>That is, only ever having 1 call to <code>update(data)</code> instead of doing:</p>
  
  <pre><code>if(cond)
  make unique
  call update
  end
  if(cond)
  make unique
  call update
  end
  ...
  </code></pre>