#include <iostream> #include <vector> #include <string> #include <memory> #include <QDebug> void Print(const std::string&RvalueAndLvalue) { std::cout<<"LandRvalue:"<<RvalueAndLvalue<<std::endl; } void Print( std::string&Lvalue) { std::cout<<"Lvalue:"<<Lvalue<<std::endl; } void Print( std::string&&Rvalue) { std::cout<<"Rvalue:"<<Rvalue<<std::endl; } int main() { std::string name="john "; std::string family="mirror"; //"name+family" is rvalue reference because it is temproary std::string fullName=name+family; Print(name+family); Print(name); return 0; }
There was an error while loading. Please reload this page.