If I understand Appendix 1 correctly, a function of the form:
// Where B is a large type.
void f(in B b) {
use(b);
}
generates the following code for the moment (ignoring bit flags):
void _generated_f(const B* b, bool __b_arg_is_nonconst_rvalue ) {
if (__b_arg_is_nonconst_rvalue) {
use(std::move(*b));
}
else {
use(b);
}
}
Assuming the function use takes b by an in parameter ( what else would it be? ) why doesn't the generated code look like this:
void _generated_f(const B* b, bool __b_arg_is_nonconst_rvalue) {
use(b, __b_arg_is_nonconst_rvalue);
}
That way we remove one unnecessary branch and the function use can optimize for r values...
Is there something I am not understanding correctly?