<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 18, 2014 at 11:19 AM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2014 Nov 18, at 10:06, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
> Unexposed, but not magic - it can be implemented in LLVM as it is in libc++. A few of these utilities are a bit of a pain to write, but they're generic enough not to need to be written very often.<br>
<br>
</span>This is spiraling into a major project :). I just want to pass in<br>
a context by reference to prevent reference/pointer disagreement<br>
in `MDString::get()` vs. `MDString::MDString()`, so I want some<br>
API that is clear and correct.<br></blockquote><div><br>I'm not sure it's so clear when this can invoke explicit ctors in a context where one would only really expect implicit conversions. Maybe for this use case it's not problematic, but for others this could be a pretty confusing stumbling block/bug.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">How about I file a PR for this? Your argument that `emplace()`<br>
would be a good abstraction here is convincing, but encapsulating<br>
`StringMap` is pretty orthogonal to my current work.<br></blockquote><div><br>If you don't have time to address this now, I'll find some & just do it - I don't really want this implicit invocation of explicit ctors sticking around.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In the meantime, I think the perfect-forwarding I added in the<br>
3-arg version of `StringMapEntry::Create()` is an incremental<br>
improvement.</blockquote><div><br>I don't think this is an incremental improvement since it can lead to explicit ctors being called essentially implicitly.</div></div><br>- David</div></div>