i just wrote a code for move constructor its being called again for value 2 passed into the pushback method
#include <iostream>
#include <vector>
using namespace std;
class n{
int *ptr;
public:
n(int d):ptr{new int(d)}{cout<<"constuctor called for "<<d<<endl;
}
n(n &&s)noexcept:ptr{s.ptr}{
s.ptr=nullptr;
cout<<"move constructor called for "<<*ptr<<endl;}//this is being called again for 2
~n(){
if(ptr==nullptr)
cout<<"freeing storage for nullptr "<<ptr<<endl;
else
cout<<"freeing storage for ptr "<<*ptr<<endl;
delete ptr;
}
};
int main() {
vector<n>b;
b.push_back(n{2});
b.push_back(n{3});;
return 0;
}