<div dir="auto">It wraps a constant T* and a size_t, so I'm surprised std::sort works. It shouldn't.</div><div class="gmail_extra"><br><div class="gmail_quote">On Sep 30, 2017 5:22 PM, "Daniel Berlin via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It seems like ArrayRefs are supposed to be immutable (<div>However, as far as i can tell, the iterators are defined wrong to make this true.</div><div><br></div><div>While </div><div>ArrayRef<int> Foo(Something);</div><div>Foo[0] = 5;</div><div><br></div><div>will give a compile time error.</div><div><br></div><div>something like:<br><br></div><div>ArrayRef<int> Foo(Something);</div><div>std::sort(Foo.begin(), Foo.end());</div><div><br></div><div>Will work fine.</div><div><br></div><div>Is this expected?</div><div><br></div><div>(FWIW: I expected this to only work with a MutableArrayRef)</div><div><br></div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>