[lldb-dev] [PATCH] std::vector::data()

Greg Clayton gclayton at apple.com
Tue Jul 20 15:43:23 PDT 2010


Yep, after I saw the header comment, I thought the same thing and I am about to commit a patch to get rid of using it.

On Jul 20, 2010, at 3:07 PM, Chris Lattner wrote:

> 
> On Jul 20, 2010, at 2:49 PM, Greg Clayton wrote:
> 
>>> From the header documentation in the stl_vector.h from our C++ library on Mac OS X:
>> 
>>     /**
>>      *   Returns a pointer such that [data(), data() + size()) is a valid
>>      *   range.  For a non-empty %vector, data() == &front().
>>      */
>>     pointer
>>     data()
>>     { return pointer(this->_M_impl._M_start); }
>> 
>> So it does state "For a non-empty %vector, data() == &front().", so I would avoid this patch for now.
> 
> std::vector::data() isn't part of C++'98.  I'd recommend using llvm::SmallVector or using &V[0] with a check that V isn't empty.
> 
> -Chris
> 





More information about the lldb-dev mailing list