[llvm-dev] MapVector for strings

Yaron Keren via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 2 08:38:54 PDT 2015


You can store the strings in a std::vector or SmallVector and use a
StringSet to ensure uniqueness.


2015-10-02 18:22 GMT+03:00 Russell Wallace via llvm-dev <
llvm-dev at lists.llvm.org>:

> I'm looking at a requirement to store a collection of strings and then
> iterate through them in an order that needs to be deterministic, but would
> do better to be the order in which they were encountered rather than
> alphabetical order. MapVector provides that order, though not for strings;
> the documentation mentioned the possibility of providing an appropriate
> specialization.
>
> However, MapVector is based on DenseMap, which is designed for pointers,
> not objects like std::string. Would it be a good idea to go ahead and use
> it anyway, or would it be better to implement my own map vector based on
> some other underlying hash map class?
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151002/7107e003/attachment.html>


More information about the llvm-dev mailing list