[Webkit-unassigned] [Bug 36849] Add zero() method to Vector class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 1 12:55:46 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=36849





--- Comment #21 from Chris Rogers <crogers at google.com>  2010-04-01 12:55:45 PST ---
(In reply to comment #17)
> (In reply to comment #14)
> > (In reply to comment #13)
> > > > Sam, thanks that looks pretty good.  Which file do you think this code belongs
> > > > in?
> > > 
> > > I think StdLibExtras.h would be good.
> > 
> > Sounds good - if nobody objects I'd like to take Sam's suggestion and just to
> > round things out also add the following function:
> > 
> > template<typename T>
> > void zeroFill(Vector<T> v)
> > {
> >     zeroFill(v.begin(). v.end());
> > }
> 
> Not sure that small bit of abstraction is much of a win. It also depends on the
> fact that the Vector iterator is a raw pointer, which isn't guaranteed.
> v.data() and v.data() + v.size() would be more robust ways to get the endpoints
> as pointers.

OK, v.data() sounds good.  At least in my use cases, and I suspect the majority
of cases, zeroFill() would be called to clear the whole vector which is what
prompted me to create the shortcut method which seems more concise.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list