[Patch] Allow to copy construct the values in llvm::StringMap
Maciej Piechotka
uzytkownik2 at gmail.com
Tue Dec 31 06:30:32 PST 2013
Hi,
Sorry for double posting - it looks like I run into problems with my MUA
and I believe my previous message just disappear.
It looks like currently it is hard to add value to llvm::StringMap which
does not have a default constructor (i.e. user needs to allocate
llvm::StringMapEntry by hand, construct it and fill it effectivly
reimplementing llvm::StringMapEntry::Create) such as llvm::Regex and it
is not possible to construct not-copy constructable value without
default constructor in C++11 by the 'hard' way.
The attached patch allows to just copy the value when lvalue reference
is passed to llvm::StringMapEntry::Create. I thought about adding the
method for C++11:
template<typename... Args>
MapEntryTy &GetOrCreateValue(StringRef Key, Args &&... Val)
But I'm not sure how it interacted with llvm::StringMapEntryInitializer
use case (there seems to be no use of it in current llvm codebase except
test and I'm not sure what's the usecase for it).
Best regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-to-CopyConstruct-the-values-in-llvm-StringMap.patch
Type: text/x-patch
Size: 3249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131231/d6eecc5e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131231/d6eecc5e/attachment.sig>
More information about the llvm-commits
mailing list