<p><pre><code>    std::vector&lt;std::string&gt; strings;
    strings.push_back(&quot;Hello&quot;);
    std::observer_ptr&lt;std::string&gt; p(&amp;strings[0]);
    strings.clear();
    std::cout &lt;&lt; p; &#x2F;&#x2F; use after free</code></pre>