<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jul 19, 2011, at 1:11 PM, David Greene wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Optima; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="font-family: monospace; ">-      ListInit *Result = new ListInit(LHSl->begin()+1, LHSl->end(),<br>+      ListInit::const_iterator begin = LHSl->begin()+1;<br>+      ListInit::const_iterator end   = LHSl->end();<br>+      // We can't pass these iterators directly to ArrayRef because<br>+      // they are not convertible to Init **.  Fortunately,<br>+      // RandomAccessIterator::operator * is guaranteed to return an<br>+      // lvalue.<br>+      ListInit *Result = new ListInit(ArrayRef<Init *>(&*begin, end - begin),<br>                                      LHSl->getType());<br></span></span></blockquote></div><br><div>That comment is really scary. ArrayRef requires elements to be laid out continuously in memory. A random access iterator doesn't guarantee that. Think std::deque.</div><div><br></div><div>How about adding a ListInit method that returns an ArrayRef instead?</div><div><br></div><div>/jakob</div><div><br></div></body></html>