That wouldn&#x27;t compile.<p>To use the header I linked it should be
`nonstd::observer_ptr&lt;std::string&gt; p(&amp;strings[0]);`<p>You also need to dereference p to use the stream operator.<p>I&#x27;m disappointed you presented such a contrived example. You also deliberately avoid const-correctness. That&#x27;s a little insidious. You need to const everything manually in C++, so as a good C++ programmer you should const <i></i>everything<i></i> as you write C++. Only carefully omit const when you need mutability.<p>We all know C++98 is dangerously unsafe. Let&#x27;s write your example in C++11.<p><pre><code>    #include &lt;iostream&gt;
    #include &lt;string&gt;
    #include &lt;vector&gt;
    #include &lt;memory&gt;
    #include &lt;utility&gt;
    #include &quot;observer_ptr.h&quot;

    &#x2F;&#x2F; kill the noise
    using std::cout;
    using std::vector;
    using std::string;
    using nonstd::observer_ptr;

    int main() {
      vector&lt;string const&gt; const strings { &quot;Hello&quot; };
      observer_ptr&lt;string const&gt; const p(&amp;strings[0]);
      strings.clear(); &#x2F;&#x2F; not gonna happen
      cout &lt;&lt; *p;
    }

    » clang++ -std=c++11 immutable.cpp
    immutable.cpp:11:5: error: member function &#x27;clear&#x27; not viable: &#x27;this&#x27; argument has type &#x27;const std::vector&lt;const std::string&gt;&#x27; (aka &#x27;const
          vector&lt;const basic_string&lt;char, char_traits&lt;char&gt;,     allocator&lt;char&gt; &gt; &gt;&#x27;), but function is not marked const
        strings.clear(); &#x2F;&#x2F; not gonna happen
        ^~~~~~~
    &#x2F;usr&#x2F;local&#x2F;Cellar&#x2F;llvm&#x2F;HEAD&#x2F;bin&#x2F;..&#x2F;include&#x2F;c++&#x2F;v1&#x2F;vector:735:    10: note: &#x27;clear&#x27; declared here
        void clear() _NOEXCEPT
             ^
    1 error generated.

</code></pre>
EDIT: Down voted for legitimate rebuttal. Nice.