variant的用法
#include <iostream>
#include <boost/typeof/typeof.hpp>
#include <boost/variant.hpp>
using namespace std;
using namespace boost;
int main()
{
variant<int, float, string>v;
v = "123";
cout << v << endl;
typedef variant<int, float, string> var_t;
var_t v1(1);
assert(v1.which() == 0);
cout << get<int>(v1) << endl;
var_t v2("string lijiajia");
cout << get<string>(v2) << endl;
v2 = v1;
assert(v2.type() == typeid(int));
var_t v3;
assert(v3.type() == typeid(int));
assert(v3.which() == 0);
v3 = "lijiajia";
cout << *get<string>(&v3) << endl;
system("pause");
return 0;
}