> On Jan 17, 2019, at 10:15 AM, Michael Catanzaro <mcatanz...@igalia.com> wrote: > > > > On Thu, Jan 17, 2019 at 11:12 AM, Darin Adler <da...@apple.com> wrote: >> Vector’s inline capacity feature was originally created as an alternative to >> variable length arrays for most of the purposes people would want to put >> them. > > Any advantages of this over std::array (which is widely-used in WebKit)?
std::array is fixed size. So you can’t do Darin’s described trick of using the stack for small enough cases but falling back to the heap for large cases, for a buffer whose size is not known at compile time. std::array seems fine to use for cases that are known to be fixed size at compile time. I would imagine it saves space by not having to separately track size and capacity. I don’t know if std::array holds its values inline or in an external heap buffer always. If it always uses a heap buffer, then it’s probably worse than a normal C array for strictly local buffers. It could still be ok for fixed-size arrays stored in objects. Regards, Maciej _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev