title: unique_ptr heap and stack allocation
body: <p>Raw pointers can point to objects allocated on the stack or on the heap.</p>
  
  <p>Heap allocation example:</p>
  
  <pre><code>// heap allocation
  int* rawPtr = new int(100);
  std::cout &lt;&lt; *rawPtr &lt;&lt; std::endl;      // 100
  </code></pre>
  
  <p>Stack allocation example:</p>
  
  <pre><code>int i = 100;
  int* rawPtr = &amp;i;
  std::cout &lt;&lt; *rawPtr &lt;&lt; std::endl;      // 100
  </code></pre>
  
  <p>Heap allocation using auto_ptr example:</p>
  
  <pre><code>int* rawPtr = new int(100);
  std::unique_ptr&lt;int&gt; uPtr(rawPtr);
  std::cout &lt;&lt; *uPtr &lt;&lt; std::endl;        // 100
  </code></pre>
  
  <p>Stack allocation using auto_ptr example:</p>
  
  <pre><code>int i = 100;
  int* rawPtr = &amp;i;
  std::unique_ptr&lt;int&gt; uPtr(rawPtr);      // runtime error
  </code></pre>
  
  <p>Are 'smart pointers' intended to be used to point to dynamically created objects on the heap?  For C++11, are we supposed to continue using raw pointers for pointing to stack allocated objects?  Thank you.</p>