[llvm-commits] [llvm] r46625 - /llvm/trunk/include/llvm/ADT/StringMap.h

Chris Lattner clattner at apple.com
Thu Jan 31 15:21:23 PST 2008


> URL: http://llvm.org/viewvc/llvm-project?rev=46625&view=rev
> Log:
> Add convenient std::string helpers to StringMap. Patch by Mikhail  
> Glushenkov!

Cool.  Before David chimes in :) , I'll point out:
>
> +  iterator find(const std::string &Key) {
> +    const char* key_start = &Key[0];
> +    return find(key_start, key_start + Key.size());
> +  }

This sort of thing won't work when the string is empty and checking is  
enabled.  Maybe something like this is enough:
   if (Key.empty()) return find(0,0);

etc.

>
-Chris



More information about the llvm-commits mailing list