#include <iostream>
#include<vector>
using namespace std;
int function(int &&p)
{
cout<<"function:"<<p<<endl;
return 0;
}
int main()
{
int a =10;
function(std::move(a));
cout<<"main:"<<a<<endl;
return 0;
}
The output I get is as below. function:10 main:10
But shouldn't it be as below? function:10 main:
Aucun commentaire:
Enregistrer un commentaire