Referencer

HaraldZealot via Digitalmars-d digitalmars-d at puremagic.com
Mon Nov 23 06:25:17 PST 2015


On Monday, 23 November 2015 at 12:09:13 UTC, Jonathan M Davis 
wrote:
> On Monday, 23 November 2015 at 11:31:32 UTC, HaraldZealot wrote:
>
> RefRange is not intended to work with output ranges, and output 
> ranges are very different beasts from input ranges, so any kind 
> of reference type wrapper for output ranges should be a 
> separate construct. That being said, I'd be inclined to argue 
> that anything taking an output range should always take it by 
> ref, precisely because copying an output range almost never 
> results in the correct semantics. So, we should probably make 
> it a general policy that anything accepting an output range 
> should accept it by ref.

So, you see that to open a PR about changes _by value_ to _by 
ref_ semantic for all functions operate with out range 
(especially for copy) is better way? But this breaks existing 
API...

> Certainly, I would think that your Referencer type is going in 
> the wrong direction, because it's declaring a bunch of 
> functions that have nothing to do with output ranges.

I see my referencer as universal wrapper to any value-like stuff 
(e.g. structs or even simple POD variable), not only for out 
ranges (or input ranges). But possibly it is to general (and so 
not perfect) solution.




More information about the Digitalmars-d mailing list