Say I have code below
#include <iostream>
void foo(std::string && s) { std::cout << s; }
void bar(std::string && s) { foo(s); }
int main() {
bar("abc");
return 0;
}
I got compiling error:
error: cannot bind ‘std::string {aka std::basic_string}’ lvalue to ‘std::string&& {aka std::basic_string&&}’ void bar(std::string && s) { foo(s); }
Aucun commentaire:
Enregistrer un commentaire