[PATCH] D90884: [SmallVector] Add `SVec<T>` / `Vec<T>` convenience wrappers.

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 13:17:35 PST 2020


dexonsmith added inline comments.


================
Comment at: llvm/docs/ProgrammersManual.rst:1618
 is often a better option due to the advantages listed above.  std::vector is
 still useful when you need to store more than ``UINT32_MAX`` elements or when
 interfacing with code that expects vectors :).
----------------
mehdi_amini wrote:
> Is this comment still relevant? The header for SmallVector is adjusting its max size right?
Here's the current logic:
```
template <class T>
using SmallVectorSizeType =
    typename std::conditional<sizeof(T) < 4 && sizeof(void *) >= 8, uint64_t,
                              uint32_t>::type;
```
I.e., it's limited to `UINT32_MAX` elements for `sizeof(T) >= 4` ("16GB should be enough for anyone"). It would probably be good to clarify this limitation, in particular since it doesn't apply to `SmallString`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90884/new/

https://reviews.llvm.org/D90884



More information about the llvm-commits mailing list