[llvm-commits] [llvm] r148463 - /llvm/trunk/include/llvm/ADT/ArrayRef.h
Chris Lattner
clattner at apple.com
Thu Jan 19 17:33:37 PST 2012
On Jan 18, 2012, at 11:01 PM, David Blaikie wrote:
> On Wed, Jan 18, 2012 at 10:34 PM, Chris Lattner <sabre at nondot.org> wrote:
>> URL: http://llvm.org/viewvc/llvm-project?rev=148463&view=rev
>> Log:
>> Introduce a new MutableArrayRef class, which refers to a series of mutable
>> T's that are consequtively in memory.
>
> Just forwarding a brief discussion I had with Chris on IRC for the
> email record - I'm pretty sure this could be implemented by switching
> things around & migrating existing ArrayRef<T> code to ArrayRef<const
> T> (& making his MutableArrayRef be the basic/generic ArrayRef
> template and partially specializing ArrayRef<const T> using the old
> ArrayRef implementation). Just thought I'd mention this in case anyone
> else had a similar thought.
Hi David,
After having thought about this a bit, I'm not sure this is a good thing to do.
By *far* the common case is than non-mutable array-ref version: punishing all clients to have to plop in a const seems really unfortunate, and your diff shows some massive code thrash that this causes. I think that forcing the unusual case to spell out MutableArrayRef is actually a good thing, because it makes things very explicit.
-Chris
More information about the llvm-commits
mailing list