-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issues with pair #87
Conversation
return pair_type<F, S>{std::forward<F>(f), std::forward<S>(s)}; | ||
using decayed_F = std::decay_t<F>; | ||
using decayed_S = std::decay_t<S>; | ||
return pair_type<decayed_F, decayed_S>{std::forward<decayed_F>(f), std::forward<decayed_S>(s)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use move
here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::forward
will have the same semantics as std::move
if F
or S
are r-value references.
You can think of std::forward
as a more generic form of std::move
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will there be a return type mismatch with the function signature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point! Used auto
return type instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrhemstad yeah, I guess my point is that since decayed_F
is not a reference type, then forward<decayed_F>
will always return an r-value, so it's identical to just using move
in this case - is my understanding correct here? and so I was thinking that move
is just shorter to use here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose you could use std::forward
with the original type as well
Superseded by #319 |
remove_const
inis_thrust_pair_like
make_pair
to usedecay_t
for the element types