#include <iostream>
using std::cin; using std::cout; using std::endl; using std::cerr;
#include <string>
using std::string;
#include <vector>
using std::vector;
#include <memory>
using std::shared_ptr;
struct X{
X() {cout << "X()" << endl;}
X(const X&){cout << "X(const X&)" << endl;}
X &operator=(const X&);
~X(){cout << "~X()" << endl;}
string a = "test";
int b = 1;
};
X &
X::operator=(const X &x) {
a = x.a;
b = x.b;
return *this;
}
//作为引用和非引用参数传递
void sumXb(X x, X &y){
cout << x.b + y.b << endl;
}
int main() {
X i, j;
shared_ptr<vector<X>> spvX;
sumXb(i, j);
auto *px = new X();
for (int k = 0; k != 10; ++k)
spvX->push_back(X());
delete px;
}