[lldb-dev] [PATCH] std::vector::data()
Chris Lattner
clattner at apple.com
Tue Jul 20 15:07:32 PDT 2010
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