debug shrink_to_fit

Paolo Carlini paolo.carlini@oracle.com
Thu Jun 9 22:05:00 GMT 2011


On 06/09/2011 10:39 PM, Paolo Carlini wrote:
> On 06/09/2011 10:20 PM, François Dumont wrote:
>> Here is a new proposition:
> This is NOT ok, you can't change shrink_to_fit itself to return a 
> bool. Plus there are many completely unexplained changes.
In practice, it seems to me that you have only two possibilities:
1- As I suggested a few days ago, simply call __shrink_to_fit both from 
the normal implementation and the debug-mode implementations of 
shrink_to_fit. The return value is checked in the latter case for 
_M_invalidate_all, etc.
2- Go for something more complex, and tailored to each specific 
container (I'm not sure it's worth it, but anyway): in that case you 
want a member function _M_shrink_to_fit in the normal-mode class, 
called, again, both by normal-mode and debug-mode shrink_to_fit.

Paolo.

PS: stylistically, open curly braces always begin a new line.



More information about the Libstdc++ mailing list