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

Greg Clayton gclayton at apple.com
Tue Jul 20 14:49:48 PDT 2010


>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.

On Jul 20, 2010, at 2:43 PM, Sebastian Redl wrote:

> 
> On Tue, 20 Jul 2010 16:32:39 -0500, William Lynch <wlynch at wlynch.cx>
> wrote:
>> Actually, I was thinking about this patch. There is probably going to be
>> bad
>> behavior when the vector is empty (and capacity is zero?). Please don't
>> apply this unless data() also has that problem.
> 
> It doesn't, or at least shouldn't. That's pretty much the point of data().
> 
> Sebastian
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev





More information about the lldb-dev mailing list