www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Primary Ranges of Containers

Hi,

last week I realized that a const version of
std.container.Array.opSlice() is missing. Now I looked at the code and I
think that it is a general design problem.

The docs state that "c.Range" is "The primary range type associated with
the container.". I think we really always need two Range types (one for
const view and one for non-const view) by design.

I'd propose to always add a bool template parameter (maybe isConst?) to
the range since most of the write-functionality can be "removed" by a
static if statement in order to make the range read-only.

Any suggestions?

Best regards,

Matthias
Jun 18 2012