Getting a range over a const Container

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 15 00:21:17 PDT 2012


On Friday, June 15, 2012 09:14:45 Matthias Walter wrote:
> Hi,
> 
> I have a const std.container object (e.g., a const(Array!int)) of which
> I'd like to have a range which can traverse that container having
> read-only access. This does not seem to be possible with opSlice(). Is
> there an alternative?

opSlice is the only way to get a range out of Array. It looks like it lacks a 
const overload for opSlice - hence why it's not working for you. Feel free to 
open an enhancement request:

http://d.puremagic.com/issues

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list