2009-10-06から1日間の記事一覧

型Fからboost::function<R(Args...)>を作る

C++

BoostML - 【function/bind】 function object type introspection template <class F> void foo(F f) { boost::function ff = f; } みたいなことがしたいんだけど、どうすればいいの、というお話。 MLではBoost.FunctionTypesで関数(オブジェクト)から 戻り値の型:r</class>…

boost::fusion::vectorからstd::tupleへの変換

C++

GCC 4.4 + Boost 1.40.0だと以下のコードはコンパイルが通りません。 #include <tuple> #include <boost/fusion/include/vector.hpp> template <class Args> struct hoge; template <class... Args> struct hoge<boost::fusion::vector<Args...>> { // エラー! typedef std::tuple<Args...> type; }; int main() {} これがエラーになるのは、GCC 4.4時点での可変引数テン</args...></boost::fusion::vector<args...></class...></class></boost/fusion/include/vector.hpp></tuple>…