dblaikie at gmail.com
Sat Jan 19 23:34:21 PST 2013
On Sat, Jan 19, 2013 at 6:00 PM, Krzysztof Parzyszek
<kparzysz at codeaurora.org> wrote:
> On 1/19/2013 7:55 PM, Sean Silva wrote:
>> Although SmallString is actually pretty inefficient, since it keeps
>> the string data separate from the "vector" header. I believe libc++'s
>> std::string actually reuses the pointers in the "vector header" as the
>> storage for the "small" size, and so in that case std::string is
>> effectively a very memory efficient SmallString with storage of
>> roughly 3 pointers' worth of chars.
> Why do we actually have all the local versions of containers that already
> exist as a part of the C++ standard (such as SmallVector, DenseMap, et al.)?
Short answer: ours are better.
Longer answer: ours are better for particular situations.
(you'll notice, for example, that DenseMap has different iterator
invalidation semantics & requires a tombstone value - by paying that
cost the container can be a bit faster and/or more memory efficient)
For details: http://llvm.org/docs/ProgrammersManual.html
More information about the llvm-dev