title: how to use std::num_put for custom pointer output formatting?
body: <h5>TLDR;</h5>
  <p>Default output of pointers with c++ iostream is of the form <code>0xdeadbeef</code>.
  What I want is pointers to be output in the form <code>#xdeadbeef</code>.</p>
  <h5>Problem</h5>
  <p>For testing purposes I output internal data of some c++ program in form of s-expressions, so I can have in the future the option to use Common Lisp to reason about the output.
  Now, hex numbers are written in the form <code>#xdeadbeef</code> and iostream default is using the C/C++ typical <code>0x...</code> syntax.</p>
  <p>So, after a bit of reading, I think I am close to finding a solution... only, at least on cppreference.com, there is not enough (demo code or explanations) to allow me to understand, how I am exactly supposed to solve this.</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;locale&gt;
  #include &lt;sstream&gt;
  #include &lt;string&gt;
  
  struct lispy_num_put : std::num_put&lt;char&gt; {
    iter_type do_put(iter_type s, std::ios_base&amp; f,
             char_type fill, const void* p) {
      std::ostringstream oss;
      oss &lt;&lt; p;
      std::string zwoggle{oss.str()};
      if (zwoggle.length() &gt; 2 &amp;&amp; zwoggle.starts_with(&quot;0x&quot;)) {
        zwoggle[0] = '#';
      }
      // ... NOW WHAT TO DO??? I.e how to send the string along?
    }
  };
  // ...
  </code></pre>
  <p>As you can see, I now have the string representation of how I want to see the pointer in the output. Only it is unclear to me, how to send that string now into the output stream.</p>
  <p>Later, I will have to use some <code>imbue()</code> thingy to make this struct used by my output stream. I think, that part I can figure out myself.</p>