Closed tcbrindle closed 1 year ago
Patch coverage: 100.00
% and no project coverage change.
Comparison is base (
06ddd52
) 97.85% compared to head (413d08f
) 97.85%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This PR changes the
flux::from()
function so that it accepts onlyadaptable_sequence
s, wrapping them in a type that inherits frominline_sequence_base
to enable chaining via member functions. If the passed-in sequence already inherits frominline_sequence_base
it is returned by value unchanged.Previously
from()
handled lvalues by callingref()
ormut_ref()
depending on constness, but this had the unfortunate effect of making it harder to spot when references where being taken. With this change, the user now need to explicitly chose betweenfrom()
(for rvalues) orref()
/mut_ref()
for lvalues as appropriate.There is one case this doesn't handle, which is where you have a forwarding reference to a sequence which you want to temporarily wrap in an adaptor for the duration of an algorithm call. (We do this in two places in the library, namely in the implementations of
sort()
andto()
.) For this case, this PR adds afrom_fwd_ref()
function which does whatfrom()
used to do -- but hopefully with a name that makes it more clear when it should be used.