2010-06-03から1日間の記事一覧

Boost.Lambda + type_switch

C++

昨日のパターンマッチ、Boost.Lambdaを使うとこう書けました。 #include <iostream> #include <utility> #include <boost/variant.hpp> #include <boost/type_switch.hpp> #include <boost/mpl/arg.hpp> #include <boost/lambda/lambda.hpp> using std::pair; typedef boost::variant< int, pair<int, double>, pair<int, int>, pair<double, int> …</double,></int,></int,></boost/lambda/lambda.hpp></boost/mpl/arg.hpp></boost/type_switch.hpp></boost/variant.hpp></utility></iostream>