<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2448.0">
<TITLE>RE: [LC++]STL and auto_ptr woes</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>> I don't think that auto_ptr<> supports the assignment </FONT>
<BR><FONT SIZE=2>> operator--it only</FONT>
<BR><FONT SIZE=2>> supports initialization via the constructor. That's why it </FONT>
<BR><FONT SIZE=2>> won't work in</FONT>
<BR><FONT SIZE=2>> your scenario.</FONT>
</P>
<P><FONT SIZE=2>[...]</FONT>
</P>
<P><FONT SIZE=2>> Is auto_ptr<> supposed to work in a Standard C++ Library </FONT>
<BR><FONT SIZE=2>> collection? I seem</FONT>
<BR><FONT SIZE=2>> to recall this as being a no-no, but I don't have the book in </FONT>
<BR><FONT SIZE=2>> front of me</FONT>
<BR><FONT SIZE=2>> right now.</FONT>
</P>
<P><FONT SIZE=2>I think you answered your own question. I vaguely remembered</FONT>
<BR><FONT SIZE=2>that auto_ptr is an STL collection would fail because of</FONT>
<BR><FONT SIZE=2>ownership issues when being copied (auto_ptr, IIRC, transfers</FONT>
<BR><FONT SIZE=2>ownership when assigned, so it does not actually duplicate</FONT>
<BR><FONT SIZE=2>but gives (mv rather than cp), so the original collection</FONT>
<BR><FONT SIZE=2>will now hold invalid data). That's what I think I remember,</FONT>
<BR><FONT SIZE=2>I think I got the actual fully explained reason in one of</FONT>
<BR><FONT SIZE=2>Scott Meyer's books, but it's quite fuzzy now, so I could be</FONT>
<BR><FONT SIZE=2>utterly wrong.</FONT>
</P>
<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Vincent Penquerc'h </FONT>
</P>
</BODY>
</HTML>