[llvm-dev] RFC: [SmallVector] Adding SVec<T> and Vec<T> convenience wrappers.

Nicolai Hähnle via llvm-dev llvm-dev at lists.llvm.org
Wed Nov 25 23:42:01 PST 2020


On Thu, Nov 26, 2020 at 7:56 AM Michael Kruse via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> Am Mi., 25. Nov. 2020 um 17:52 Uhr schrieb David Blaikie via llvm-dev
> <llvm-dev at lists.llvm.org>:
> > I'm still not sure why "at least 1" is an important goal. I'd be
> > curious to hear from Chris/others why that's especially valuable.
>
> If N is 0, then it's not a small-size optimized vector, in contrast to
> what the name implies.
>
> Actually, if the intention is to have no inlined elements, I think one
> should use std:vector. Generally, projects should not reinvent STL
> containers and prefer the standard library one unless there is a good
> enough reason not to use them.

I agree for regular code, but SmallVector can be and is used in
templates as SmallVector<T, N> where T is not known to the code
writer. I'm also curious what makes the number 1 so special.

Cheers,
Nicolai

-- 
Lerne, wie die Welt wirklich ist,
aber vergiss niemals, wie sie sein sollte.


More information about the llvm-dev mailing list