<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
Hi&nbsp;<div><br></div><div>&nbsp; &nbsp; Currently I am working on upgrading our system to work with MsDev2010 - our system uses GCC_XML to parse our project in order to get information about the produced DLL.</div><div><br></div><div>&nbsp; &nbsp;That being said I found a few newer versions of GCC_XML some of which had implemented some STL types, for example vector: in the include for "Vc8ex" there is a file that contains the definition of the vector class. For the other classed I created my own definitions however I am&nbsp;concerned&nbsp;that my output will not work as expected see my definition for shared pointer:</div><div><br></div><div>template&lt;class _Ty&gt;<span class="Apple-tab-span" style="white-space:pre">        </span>struct shared_ptr {};</div><div><br></div><div>&nbsp; &nbsp;GCC_XML has no problem parsing this and my code seems to function correctly. However what about the class size? Will the compiler adjust for the actual size of the class or is there a&nbsp;possibility&nbsp;that my objects body will overlap in the heap?</div><div><br><strong>Chris Lamothe<br></strong></div><div><strong><br></strong></div><div><strong>P.S. Why is my stub so much simpler than auto_ptr? - See below, looks like the whole H file.</strong></div><div><strong><br></strong></div><div><div>template&lt;class _Ty&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>class auto_ptr</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// wrap an object pointer to ensure destruction</div><div>public:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>typedef _Ty element_type;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>explicit auto_ptr(_Ty *_Ptr = 0) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>: _Myptr(_Ptr)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// construct from object pointer</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>auto_ptr(auto_ptr&lt;_Ty&gt;&amp; _Right) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>: _Myptr(_Right.release())</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// construct by assuming pointer from _Right auto_ptr</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>auto_ptr(auto_ptr_ref&lt;_Ty&gt; _Right) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// construct by assuming pointer from _Right auto_ptr_ref</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Ty **_Pptr = (_Ty **)_Right._Ref;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Ty *_Ptr = *_Pptr;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>*_Pptr = 0;<span class="Apple-tab-span" style="white-space:pre">        </span>// release old</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Myptr = _Ptr;<span class="Apple-tab-span" style="white-space:pre">        </span>// reset this</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>template&lt;class _Other&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>operator auto_ptr&lt;_Other&gt;() _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// convert to compatible auto_ptr</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (auto_ptr&lt;_Other&gt;(*this));</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>template&lt;class _Other&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>operator auto_ptr_ref&lt;_Other&gt;() _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// convert to compatible auto_ptr_ref</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Other *_Testptr = (_Ty *)_Myptr;<span class="Apple-tab-span" style="white-space:pre">        </span>// test implicit conversion</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>auto_ptr_ref&lt;_Other&gt; _Ans(&amp;_Myptr);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (_Testptr != 0 ? _Ans : _Ans);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>template&lt;class _Other&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>auto_ptr&lt;_Ty&gt;&amp; operator=(auto_ptr&lt;_Other&gt;&amp; _Right) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// assign compatible _Right (assume pointer)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>reset(_Right.release());</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (*this);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>template&lt;class _Other&gt;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>auto_ptr(auto_ptr&lt;_Other&gt;&amp; _Right) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>: _Myptr(_Right.release())</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// construct by assuming pointer from _Right</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>auto_ptr&lt;_Ty&gt;&amp; operator=(auto_ptr&lt;_Ty&gt;&amp; _Right) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// assign compatible _Right (assume pointer)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>reset(_Right.release());</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (*this);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>auto_ptr&lt;_Ty&gt;&amp; operator=(auto_ptr_ref&lt;_Ty&gt; _Right) _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// assign compatible _Right._Ref (assume pointer)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Ty **_Pptr = (_Ty **)_Right._Ref;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Ty *_Ptr = *_Pptr;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>*_Pptr = 0;<span class="Apple-tab-span" style="white-space:pre">        </span>// release old</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>reset(_Ptr);<span class="Apple-tab-span" style="white-space:pre">        </span>// set new</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (*this);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>~auto_ptr()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// destroy the object</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>delete (_Ty *)_Myptr;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>_Ty&amp; operator*() const _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// return designated value</div><div><br></div><div>&nbsp;#if _HAS_ITERATOR_DEBUGGING</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (_Myptr == 0)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>_DEBUG_ERROR("auto_ptr not dereferencable");</div><div>&nbsp;#endif /* _HAS_ITERATOR_DEBUGGING */</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>__analysis_assume(_Myptr);</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (*(_Ty *)_Myptr);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>_Ty *operator-&gt;() const _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// return pointer to class object</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (&amp;**this);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>_Ty *get() const _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// return wrapped pointer</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return ((_Ty *)_Myptr);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>_Ty *release() _THROW0()</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// return wrapped pointer and give up ownership</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Ty *_Tmp = (_Ty *)_Myptr;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Myptr = 0;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return (_Tmp);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>void reset(_Ty* _Ptr = 0)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{<span class="Apple-tab-span" style="white-space:pre">        </span>// destroy designated object and store new pointer</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (_Ptr != _Myptr)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>delete (_Ty *)_Myptr;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>_Myptr = _Ptr;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div>private:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>const _Ty *_Myptr;<span class="Apple-tab-span" style="white-space:pre">        </span>// the wrapped object pointer</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>};</div></div><div><br></div><div><strong><br></strong></div>                                               </div></body>
</html>