title: Passing unique_ptr to functions
body: <p>I'm trying to "modernize" some existing code. </p>
  
  <ul>
  <li>I have a class which currently has a member variable "Device* device_". </li>
  <li>It uses new to create an instance in some initialization code and has a "delete device_" in the destructory. </li>
  <li>Member functions of this class call <em>many</em> other functions that take a Device* as a parameter.</li>
  </ul>
  
  <p>This works well, but to "modernize" my code I thought I ought to change the variable to be defined as <code>"std::unique_ptr&lt;Device&gt; device_"</code> and remove the explicit call to delete, which makes the code safer and generally better.</p>
  
  <p>My question is this -</p>
  
  <ul>
  <li>How should I then pass the <em>device</em>_ variable to all of the functions that need it as a paramater?</li>
  </ul>
  
  <p>I can call .get to get the raw pointer in each function call. But that seems ugly and wastes some of the reasons to use a unique_ptr in the first place.</p>
  
  <p>Or I can change <em>every</em> function so that instead of taking a parameter of type "Device*" it now takes a paramater of type "std::unique_ptr&amp; ". Which (to me) somewhat obfuscates the function prototypes, and makes them hard to read.</p>
  
  <p>What is best practice for this? Have I missed any other options?</p>