You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem I have with tie_from_structure is that it calls copy assignments instead of move assignments.
I think I understand why it happens: you convert the structure on the rhs of operator= into tuple of refs, and then assign it to the tuple of refs on the lhs.
Have you ever been thinking about a way to convert the structure on the rhs into a tuple of values, not refs?
To be more specific, I want to create a tuple, somehow call std::move on each member of the structure , and then assign that tuple (which now will be a rval) to the tuple of refs on the lhs of the operator?
This way it should work same as for std::tie.
I'm not familiar enough with your library to implement like that, so for now I'm using a workaround where I put both lhs args and rhs structure as a single function parameters:
With this implementation you call move assignment for all members of the structure.
What do you think about it? Would it be possible to add sth like this to your library?
The text was updated successfully, but these errors were encountered:
Hi all, thanks for great work.
The problem I have with tie_from_structure is that it calls copy assignments instead of move assignments.
I think I understand why it happens: you convert the structure on the rhs of operator= into tuple of refs, and then assign it to the tuple of refs on the lhs.
Have you ever been thinking about a way to convert the structure on the rhs into a tuple of values, not refs?
To be more specific, I want to create a tuple, somehow call std::move on each member of the structure , and then assign that tuple (which now will be a rval) to the tuple of refs on the lhs of the operator?
This way it should work same as for std::tie.
I'm not familiar enough with your library to implement like that, so for now I'm using a workaround where I put both lhs args and rhs structure as a single function parameters:
https://godbolt.org/z/ajrGMPMez
Edit:
Ok, so here is a working example of how I would like the tie_from_structure to behave:
Same example on godbolt: https://godbolt.org/z/Yq9nqdYnW
With this implementation you call move assignment for all members of the structure.
What do you think about it? Would it be possible to add sth like this to your library?
The text was updated successfully, but these errors were encountered: