<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div></div><div><br></div><div>-Nick</div><br><div><div>On Jan 15, 2014, at 11:46 AM, <a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a> wrote:</div><blockquote type="cite">I don't know enough about BumpPtrAllocator's design/intended use to know how well these new APIs fit - but both the templated forms are unsafe for non-trivial types (ArrayRef<std::string> for argument's sake) which is a bit scary - at least they could have some static assert/SFINAE/something to limit their use to safe cases if they aren't going to be generalized.<br>
<br><div>On Tue Jan 14 2014 at 1:32:28 PM, Nick Kledzik <<a href="mailto:kledzik@apple.com">kledzik@apple.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;">
It is easy to use BumPtrAllocator with placement-new to allocate and initialize a C++ object, but it is harder to allocate and copy other types with BumpPtrAllocator, such as StringRef.  I did not see any helper utils to do that, so I wrote this patch.  I added a few variations of allocateCopy() which each make allocating and copying different types easier.<br></blockquote></blockquote></div><br></body></html>