Note that there are some explanatory texts on larger screens.

plurals
  1. POThe purpose behind empty struct?
    primarykey
    data
    text
    <p>Declarations of auto_ptr from C++ Standard Library</p> <pre><code>namespace std { template &lt;class Y&gt; struct auto_ptr_ref {}; template &lt;class X&gt; class auto_ptr { public: typedef X element_type; // 20.4.5.1 construct/copy/destroy: explicit auto_ptr(X* p =0) throw(); auto_ptr(auto_ptr&amp;) throw(); template &lt;class Y&gt; auto_ptr(auto_ptr&lt;Y&gt;&amp;) throw(); auto_ptr&amp; operator=(auto_ptr&amp;) throw(); template &lt;class Y&gt; auto_ptr&amp; operator=(auto_ptr&lt;Y&gt;&amp;) throw(); auto_ptr&amp; operator=(auto_ptr_ref&lt;X&gt;) throw(); ~auto_ptr() throw(); // 20.4.5.2 members: X&amp; operator*() const throw(); X* operator-&gt;() const throw(); X* get() const throw(); X* release() throw(); void reset(X* p =0) throw(); // 20.4.5.3 conversions: auto_ptr(auto_ptr_ref&lt;X&gt;) throw(); template &lt;class Y&gt; operator auto_ptr_ref&lt;Y&gt;() throw(); template &lt;class Y&gt; operator auto_ptr&lt;Y&gt;() throw(); }; </code></pre> <p>}</p> <p>I don't understand the purpose of this part:</p> <pre><code>template &lt;class Y&gt; struct auto_ptr_ref {}; </code></pre> <p>Without declaring any variable, how can these be valid:</p> <pre><code>auto_ptr&amp; operator=(auto_ptr_ref&lt;X&gt;) throw(); </code></pre> <p>and these too:</p> <pre><code>auto_ptr(auto_ptr_ref&lt;X&gt;) throw(); template &lt;class Y&gt; operator auto_ptr_ref&lt;Y&gt;() throw(); </code></pre> <p><strong>Edit:</strong> and also (I just notice) I don't understand how the "operator" are used for the last two lines. Isn't the syntax something like "return-type operatoroperand;", where is the return type? operand? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload