Transforming a range back to the original type?

Jonathan M Davis jmdavisProg at gmx.com
Fri May 4 10:15:26 PDT 2012


On Friday, May 04, 2012 13:46:33 Jacob Carlborg wrote:
> I give up. Apparently you don't think it's useful.

If you can come up with an example/reason why it would actually be useful, 
then great. But I don't see why it would ever matter what the original 
container type really was.

You need the original range type in cases like std.container's remove 
function, but then the range must _be_ the original range type from that exact 
container in order to work, and there's no way that you could turn a wrapped 
range into the proper range for that, since you'd have to create a new 
container, and then the resultant range would be for the wrong container. And 
that's the only situation that I can think of where it really matters what the 
original container type was. If you want to construct a new container out of a 
range, then great, but since it's a new container, I don't see how it matters 
what the original container was unless you intend to assign the result to the 
new container or somesuch, in which case, you would already have access to the 
type, because you'd have a variable to assign to.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list