www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [RFC] semantics of containers of const

Gonna make multi_index take const and immutable element types.

I think it makes perfect sense to support insert/remove/replace 
operations for containers of const elements.

My only arguments are it's possible without violating D's constness 
rules and the constness of the element should have no bearing on the 
constness of the container.

But it does look kinda funny to see

container[i] = newitem;

for a container of immutable(T). (replace index assign with front=, etc, 
as fit)

Requesting discussion as there isn't much precedence for this in D at 
the moment.

And with arrays, the semantics of const are married up with the 
semantics of contiguous memory, so I don't think it provides the best 
guide for containers in general.
Nov 27 2012