Last active
December 3, 2021 22:49
-
-
Save LucianoPAlmeida/8a11e1b35814889d41c9d5d853703a4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
void f(T&& param); | |
// T is deduced so && means universal reference | |
void f(std::string&& param); | |
// No deduction involved so && means r-value reference | |
template<typename T> | |
void a(T&& param) { /*does something*/ } | |
template<typename T> | |
void b(T&& param) { | |
// Since both are UR forward preserve valueness function | |
// `a` will receive a l or r value depending on the param | |
// passed to `b`. | |
a(std::forward<T>(param)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment