Ruling out arbitrary cost copy construction?

Michel Fortin michel.fortin at michelf.com
Thu Oct 7 05:34:18 PDT 2010


On 2010-10-07 02:09:04 -0400, Andrei Alexandrescu 
<SeeWebsiteForEmail at erdani.org> said:

> I agree with all of the above. After all has been said and done, it 
> looks like uniform function call syntax is a pivotal feature for 
> simplifying ranges. Most ranges can simply define the basic operations, 
> and std.range takes care of defining boilerplate defaults for a host of 
> cases. For example, you just call r.moveFront() and that becomes 
> moveFront(r) which is defined by std.range.

That's good. I'm glad to see that using move semantics is still on the table.

Another note, you don't really need to wait for the uniform function 
call syntax for this to work. The moveFront function template in 
std.range could check for the presence of moveFront in the range and 
call it when available. This means you have to write moveFront(r) 
everywhere instead of r.moveFront(), which might be an annoyance but at 
least it works.


> Whenever the range is defined in a way that makes it impossible to 
> generate e.g. moveFront() appropriately, the user would have to. Would 
> this be acceptable?

Seems good to me.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list