[LLVMdev] Addressing const reference in ArrayRef

Reid Kleckner rnk at google.com
Fri Aug 22 10:50:48 PDT 2014


On Fri, Aug 22, 2014 at 10:43 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
> Yep - the convenience of one-element->ArrayRef is "cute" at best, I
> think. Having to wrap it doesn't seem detrimental. Would have to look
> at some numbers, though (if we could easily gather the number of
> instances of this - I'm not sure of the easiest way to do that, given
> the build system likes to stop after it sees an error).
>
> I'm not sure if the "Temp" in the name would be a sufficient
> deterrent, but maybe.


Wow, I think I finally understand how the temporary is being created.

Can we get by without the single element constructor? Callers would have to
write:
const char *strs[] = { "string" };
foo(strs);

Instead of foo("string"), which is subtle anyway.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140822/98a94614/attachment.html>


More information about the llvm-dev mailing list