#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<numeric>
#include<list>
#include<map>
#include<set>
#include<iterator>
#include<functional>
#include<memory>
using namespace std;
using namespace std::placeholders;
struct X {
X() { printf("构造函数X()\n"); }
X(const X&) { printf("拷贝构造函数X(const X&)\n"); }
X& operator = (const X&rs) { printf("拷贝赋值函数operator X(const X&)\n"); return *this; }
~X() { printf("析构函数~X()\n"); }
};
void f1(X x){}
void f2(X &x){}
int main() {
printf("局部变量\n");
X x;
printf("------------------\n");
printf("非引用参数传递\n");
f1(x);
printf("-------------------\n");
printf("引用参数传递\n");
f2(x);
printf("-------------------\n");
printf("动态分配\n");
X *px = new X;
printf("-------------------\n");
printf("添加容器\n");
vector<X> v;
v.push_back(x);
printf("-------------------\n");
printf("释放动态分配对象\n");
delete px;
printf("-------------------\n");
printf("间接初始化和赋值\n");
X y = x;
y = x;
printf("-------------------\n");
system("pause");
}