Here's some code:<div><br></div><div>-------------------------------------</div><div>class MyThing {</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>int x;</div><div>}</div><div>// Two identical arrays, typewise</div>
<div>MyThing arga[0];</div><div>MyThing argb[0];</div><div><br></div><div>// Create an instance</div><div>MyThing thing;</div><div>5 => thing.x;</div><div><br></div><div>// Push it into arga</div><div>arga << thing;</div>
<div>// Push it into argb</div><div>argb << thing;</div><div><br></div><div><<< "n=", arga[0].x >>>;</div><div><<< "n=", argb[0].x >>>;</div><div><br></div><div>
// clear arga</div><div>0 => arga.size;</div><div>// clear argb - crash!</div><div>0 => argb.size;</div><div>-------------------------------------<br clear="all"><br></div><div>when I run it I get:</div><div><br></div>
<div>-------------------------------------</div><div>$ chuck test.</div><div>ck</div><div>n= 5 </div><div>n= 5 </div><div>chuck_oo.cpp:120: failed assertion `m_ref_count > 0'</div><div>Abort trap</div><div>-------------------------------------<br>
<br></div><div>It seems that that 0 => arga.size decrements a reference count for thing, causing it to be freed, and then when the same thing is attempted for argb, it crashes. Possibly some reference increment missing when doing argb << thing ?</div>
<div><br></div><div>/Stefan</div><div><br></div><div>-- <br>Release me, insect, or I will destroy the Cosmos!<br>
</div>