[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-dev
Subject:    Re: [webkit-dev] Compile error in WebGL2RenderingContext.cpp
From:       Maciej Stachowiak <mjs () apple ! com>
Date:       2019-01-17 19:13:51
Message-ID: 5A78837A-D3CC-40D9-9345-1D0F1D805E82 () apple ! com
[Download RAW message or body]



> On Jan 17, 2019, at 10:15 AM, Michael Catanzaro <mcatanzaro@igalia.com> wrote:
> 
> 
> 
> On Thu, Jan 17, 2019 at 11:12 AM, Darin Adler <darin@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic