Preview switches
Stanislav Blinov
stanislav.blinov at gmail.com
Sat Jun 20 16:57:03 UTC 2020
On Saturday, 20 June 2020 at 14:36:25 UTC, Q. Schroll wrote:
> While "implement <DIP link omitted>" do link to documents
> explaining details, I have no idea what `rvaluerefparam` does
> exactly. Is there an (online) resource where details to the
> others are given or linked?
Ostensibly, it should enable binding of rvalues (temporaries) as
ref arguments for functions (a-la how in C++ temporaries bind to
const T&), i.e.
Tea makeSomeTea() { /* ... */ }
void takeSomeTea(ref const Tea) { /* ... */ }
void main()
{
takeSomeTea(makeSomeTea());
}
Without that switch, the above won't compile, because
historically D disallowed such binding. Manu (among others)
pushed for this to be possible, hence the switch. Though
implementation, AFAICT, is still somewhere in the "under
construction" territory, judging by Bugzilla.
More information about the Digitalmars-d
mailing list