Ranges: is it ok if front is a data member?

Chris Cain clcain at uncg.edu
Thu Dec 12 23:45:05 PST 2013


On Friday, 13 December 2013 at 07:28:57 UTC, qznc wrote:
> Ouch. That surely is confusing. Why don't arrays provide .put 
> which appends the element?

Basically, when you're using an array as an output range, you're 
saying "Hey, here's a slice of memory to put the results in". 
You're _not_ saying "hey, here's a bit of memory that I have 
already, so put it on the end of it."

The behavior is technically correct, but output ranges probably 
aren't being described as well as they could be. That said, the 
concept is a bit unusual and strange to me as well. I love the 
concept of InputRanges but I'd really like to see more coverage 
on OutputRanges and how to work effectively with them (and, 
especially, arrays as OutputRanges).


More information about the Digitalmars-d-learn mailing list