int main(){ boost::function<int(int, int)> division_func = &division; assert(division_func(10, 2) == 5); boost::function<bool(int)> is_even = [](int n)->bool{ return n % 2 == 0; }; assert(is_even(4) == true); boost::function<bool()> three_is_even = boost::bind(is_even, 3); assert(three_is_even() == false); boost::function<bool(int, int)> is_equal_int(&is_equal<int>); assert(is_equal_int(10, 10) == true); boost::function<void(game*, int)> any_game_even(&game::even1); game g; any_game_even(&g, 10); boost::function<void(int)> any_game_even2 = boost::bind(&game::even2, &g, ::_1); any_game_even2(10); return 0; }
0 件のコメント:
コメントを投稿