#include <iostream>
#include <vector>
using namespace std;
int main(void){
vector<int> a;
a.push_back(3);
vector<int> b = move(a);
cout<<"b: "<<b.data()<<endl;
cout<<"a: "<<a.data()<<endl;
return 0;
}
Output(in c++98):
b: 0x7f9a82405730
a: 0x7f9a82405720
Output(in c++11):
b: 0x7f9a82405730
a: 0x0
I am using clang.
No compiler flags are used for the second output.
-std=c++11 flag for the second output.
I know what move() does in c++11 (and higher versions). But as I can see using move() in c++98 does nothing to the object passed and just deep copy happens.
Then why is there a move() in c++98??
Aucun commentaire:
Enregistrer un commentaire