2010-09-30から1日間の記事一覧

boost::function で Loki Chain のような処理

ここまでは考えた。 #include <iostream> #include <boost/function.hpp> #include <boost/functional.hpp> #include <boost/function_types/result_type.hpp> #include <boost/bind.hpp> #include <boost/utility/result_of.hpp> #include <boost/fusion/include/vector.hpp> #include <boost/fusion/include/at_c.hpp> // boost::b…</boost/fusion/include/at_c.hpp></boost/fusion/include/vector.hpp></boost/utility/result_of.hpp></boost/bind.hpp></boost/function_types/result_type.hpp></boost/functional.hpp></boost/function.hpp></iostream>

boost::bind

boost::function の引数を自由に設定することが出来る。 #include <boost/function.hpp> #include <boost/functional.hpp> #include <boost/bind.hpp> int division(int n, int m){ return n / m; } int main(){ // あらかじめ引数を設定することが出来る boost::function<int()> div_6_3 = boost::bind(division, 6, 3); asser</int()></boost/bind.hpp></boost/functional.hpp></boost/function.hpp>…

boost::function

関数の保持を行うライブラリ。 #include <iostream> #include <assert.h> #include <boost/function.hpp> #include <boost/functional.hpp> #include <boost/bind.hpp> int division(int n, int m){ return n / m; } template<typename T> bool is_equal(const T& lhs, const T& rhs){ return lhs == rhs; } struct game{ void even1(int …</typename></boost/bind.hpp></boost/functional.hpp></boost/function.hpp></assert.h></iostream>