[llvm-dev] Is ArrayRef supposed to be immutable?
Reid Kleckner via llvm-dev
llvm-dev at lists.llvm.org
Sat Sep 30 17:35:09 PDT 2017
It wraps a constant T* and a size_t, so I'm surprised std::sort works. It
shouldn't.
On Sep 30, 2017 5:22 PM, "Daniel Berlin via llvm-dev" <
llvm-dev at lists.llvm.org> wrote:
It seems like ArrayRefs are supposed to be immutable (
However, as far as i can tell, the iterators are defined wrong to make this
true.
While
ArrayRef<int> Foo(Something);
Foo[0] = 5;
will give a compile time error.
something like:
ArrayRef<int> Foo(Something);
std::sort(Foo.begin(), Foo.end());
Will work fine.
Is this expected?
(FWIW: I expected this to only work with a MutableArrayRef)
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170930/3a050967/attachment.html>
More information about the llvm-dev
mailing list