STL vector

random@bubblescope.net random@bubblescope.net
Thu Nov 3 15:49:00 GMT 2005


Mws wrote:

>On Tuesday 01 November 2005 11:01, Dima Sorkin wrote:
>  
>
>>>i'll think i'll implement my own templates for the std::<classes> with
>>>extended safety.
>>>      
>>>
>> Before you do it, try debug mode of STLport (www.stlport.org).
>>It is almost paranoidal mode, it checks things you could not even
>>fantasize about.
>>
>>Regards,
>> Dima.
>>
>>    
>>
>yes, i downloaded it and had a look at the source:
>
>  void pop_back() {
>    --this->_M_finish;
>    _Destroy(this->_M_finish);
>  }
>
>the same unchecked stuff :)
>
>  
>
Just to point it out, if you check the debugging version (it lives in
debug/vector), the function looks like:

void
pop_back()
      {
        __glibcxx_check_nonempty();
        iterator __victim = end() - 1;
        __victim._M_invalidate();
        _Base::pop_back();
      }

Some nice checking there :)

Chris



More information about the Gcc-help mailing list