This patch adds a capability to SmallVector to decide a number of inlined
elements automatically. The policy is:
- A minimum of 1 inlined elements, with more as long as sizeof(SmallVector<T>) <= 64.
- If sizeof(T) is "too big", then trigger a static_assert: this dodges the more pathological cases
This is expected to systematically improve SmallVector use in the
LLVM codebase, which has historically been plagued by semi-arbitrary /
cargo culted N parameters, often leading to bad outcomes due to
excessive sizeof(SmallVector<T, N>). This default also makes
programming more convenient by avoiding edit/rebuild cycles due to
forgetting to type the N parameter.
I expand on what reasonable means here. I'd say "reasonable for inline allocation on the stack" or something like that, maybe even give the target number of inline bytes so people have a mental model.