Binding rvalues to ref parameters redux
Nick Treleaven
nick at geany.org
Wed Apr 3 17:03:17 UTC 2019
On Tuesday, 2 April 2019 at 23:40:42 UTC, Nicholas Wilson wrote:
> On Monday, 1 April 2019 at 16:43:15 UTC, bitwise wrote:
>> So finally, I would suggest that rvalues only bind to 'in ref'.
>
> This comes down to an opt in vs opt out, 'in ref' (leaving
> aside the issues with const) mean that bindings and code must
> be updated to allow use, whereas rvalues not binding to 'out
> ref' allows immediate use. I'm for opt out.
BTW `out` can't be used like `ref`, there's no way to pass data
in to the function. From the docs:
out parameter is initialized upon function entry with the default
value for its type
More information about the Digitalmars-d
mailing list