#include <iostream>

#include <vector>

#include <string>


using namespace std;


class Test{

private:

string data;

public:

Test(const string & data): data(data){}

Test & operator = (const string & data){

this->data = data;

return *this;

}

string get_str()const{return data;}

friend ostream & operator << (ostream & os, const Test & test);

};


inline ostream &

operator << (ostream & os, const Test & test){

os << test.data;

return os;

}


vector<void *> ve;


void show_data(){

for(auto & elem : ve){

cout << *static_cast<string *> (elem)<< endl;

}

}


template<typename T, typename ...Ts>

void show_data(T & elem, Ts &... data){

ve.push_back(static_cast<void *> (&elem));

show_data(data...);

}

 

// 测试 C++ 11 for 和 auto 

void test1(){

vector<Test> test;

int num = 3;

while(num--){

test.push_back(Test("Hello!"));

}

for(auto & elem : test){

cout << elem << endl;

elem = "666";

}

for(auto & elem : test){

cout << elem << endl;

}

}


// 测试 C++11 不定模板参数 

void test2(){

string str = "Hello my friend!";

string str2 = "You are welcome!";

string str3 = "Hello world!";

show_data(str2, str, str3);

}


int main(){


test1();

test2();

return 0;

}