Re: Returning range of inout objects from inout method

2020-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/20 4:07 PM, Steven Schveighoffer wrote: On 7/25/20 3:16 PM, FreeSlave wrote: On Saturday, 25 July 2020 at 14:19:15 UTC, Steven Schveighoffer wrote: The only way to do this without code duplication (but with generated code duplication) is to template the byAction function on the type o

Re: Returning range of inout objects from inout method

2020-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/20 3:16 PM, FreeSlave wrote: On Saturday, 25 July 2020 at 14:19:15 UTC, Steven Schveighoffer wrote: The only way to do this without code duplication (but with generated code duplication) is to template the byAction function on the type of `this`: auto byAction(this This)() { /* same

Re: Returning range of inout objects from inout method

2020-07-25 Thread FreeSlave via Digitalmars-d-learn
On Saturday, 25 July 2020 at 14:19:15 UTC, Steven Schveighoffer wrote: The only way to do this without code duplication (but with generated code duplication) is to template the byAction function on the type of `this`: auto byAction(this This)() { /* same implementation */ } Note that this O

Re: Returning range of inout objects from inout method

2020-07-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/25/20 8:26 AM, FreeSlave wrote: I want to be able to return a range of const objects from the const object and a range mutable objects from the mutable object. inout comes to mind, but not applicable in this case, because inout must be applied to the return type as whole, which does not m

Returning range of inout objects from inout method

2020-07-25 Thread FreeSlave via Digitalmars-d-learn
I want to be able to return a range of const objects from the const object and a range mutable objects from the mutable object. inout comes to mind, but not applicable in this case, because inout must be applied to the return type as whole, which does not make much sense for the range. Definin