[Patch] Allow to copy construct the values in llvm::StringMap

dblaikie at gmail.com dblaikie at gmail.com
Wed Jan 1 11:12:21 PST 2014


Unit tests would be nice

On Tue Dec 31 2013 at 9:15:41 AM, Maciej Piechotka <uzytkownik2 at gmail.com>
wrote:

> On Tue, 2013-12-31 at 15:30 +0100, Maciej Piechotka wrote:
> > 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
>
> Updated patch - I wasn't aware of LLVM feature macros.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140101/75f8aeb2/attachment.html>


More information about the llvm-commits mailing list