search for: maketemparrayref

Displaying 2 results from an estimated 2 matches for "maketemparrayref".

2014 Aug 21
2
[LLVMdev] Addressing const reference in ArrayRef
On Thu, Aug 21, 2014 at 10:34 AM, Reid Kleckner <rnk at google.com> wrote: > Is there some way we can get lifetime extension of temporaries to kick in > here? Nope - since the temporary is a subexpression - not the thing being declared. > > > On Thu, Aug 21, 2014 at 8:05 AM, David Blaikie <dblaikie at gmail.com> wrote: >> >> Yeah - I suspect there are just
2014 Aug 22
4
[LLVMdev] Addressing const reference in ArrayRef
...s... (RHS of an && for assertions, etc)). Of course that would be thwarted by moving the string into a local variable. Nothing perfect here. > If we remove the `ArrayRef` constructor AND the helper, and add a new > helper like: > > template <class T> ArrayRef<T> makeTempArrayRef(const T &OneElt) { > return ArrayRef<T>(&OneElt, &OneElt + 1); > } > > then both types of bugs will be more rare and obvious. > > For the OP's case, the name "Temp" makes it more clear that the ArrayRef > shouldn't be named. For my...