Skip to content

F.18: Confused about difference between "will-move-from", "forward" and "in" #1407

@russellmcc

Description

@russellmcc

Hi! I'm writing in the hope that we can can clarify the cases in which F.16 applies vs. the cases in which F.18 or F.19 applies. Without having the terms "forward", "will-move-from", and "in" defined, I'm honestly not sure what the guidelines are recommending in certain cases. Just as one example, consider the following toy:

    struct A {
      vector<int> data;
    };
    
    struct B {
      vector<int> data;
    };
    
    B convert(A a) {
      return B{std::move(a.data)};
    }

Here, which rule applies to the parameter a in convert? Is it an "in" parameter? Is it a "will-move-from" parameter? Is it a "forward" parameter? I'm not sure how to make the distinction, and if pressed I could create arguments for all three options. This is important because without understanding which case we're in, it's impossible to know how I'm supposed to write the convert function in accordance with the guidelines.

Please note, I'm not asking for help specifically writing this convert function, this is just one example. I'm confused about these guidelines in numerous other cases as well. I think for this set of guidelines to be truly useful to me, I need actual definitions for "in", "will-move-from", and "forward".

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions