title: Is there a C++ way to format addresses and pointers with iostream?
body: <p>I have something like </p>
  
  <pre><code>unsigned x = 16;
  unsigned* p = &amp;x;
  
  std::cout &lt;&lt; std::hex &lt;&lt; std::setw(16) &lt;&lt; std::setfill('0') &lt;&lt; x &lt;&lt; std::endl;
  std::cout &lt;&lt; std::hex &lt;&lt; std::setw(16) &lt;&lt; std::setfill('0') &lt;&lt; p &lt;&lt; std::endl;
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>0000000000000010
  000x7fffc35ba784
  </code></pre>
  
  <p>ostream::operator&lt;&lt; is overloaded for this? I can write this correctly with C, but I was wondering if there is a proper way to do this with iostream. </p>