2009년 10월 12일 월요일

variant

결과)
10
20
apple
사과

소스)

#include "stdafx.h"
#include <boost/utility.hpp>
#include <boost/variant.hpp>
#include <boost/any.hpp>
#include <list>
using namespace std;
using namespace boost;



int main()
{
typedef variant<int,string,double> Node;
typedef list<Node>  Nodes;
Nodes nodes;

nodes += 10;
nodes += 20.0;
nodes += "apple";
nodes += "사과";
BOOST_FOREACH(Node& node, nodes)
{
cout<<node<<endl;
}
return 0;

}

댓글 없음:

댓글 쓰기