Ticket #3075: lambda.diff
File lambda.diff, 2.7 KB (added by , 13 years ago) |
---|
-
bind_tests_advanced.cpp
27 27 #include <algorithm> 28 28 29 29 30 using namespace boost::lambda; 30 using namespace boost::lambda; 31 namespace bl = boost::lambda; 31 32 32 33 int sum_0() { return 0; } 33 34 int sum_1(int a) { return a; } … … 91 92 // This would result in; 92 93 // bind(_1 + 1, _1)(make_const(100)) , which would be a compile time error 93 94 94 return b ind(unlambda(f), _1)(make_const(100));95 return bl::bind(unlambda(f), _1)(make_const(100)); 95 96 96 97 // for other functors than lambda functors, unlambda has no effect 97 98 // (except for making them const) … … 116 117 117 118 BOOST_CHECK(call_with_101(_1 + 1) == 102); 118 119 119 BOOST_CHECK(call_with_100(b ind(std_functor(std::bind1st(std::plus<int>(), 1)), _1)) == 101);120 BOOST_CHECK(call_with_100(bl::bind(std_functor(std::bind1st(std::plus<int>(), 1)), _1)) == 101); 120 121 121 122 // std_functor insturcts LL that the functor defines a result_type typedef 122 123 // rather than a sig template. 123 b ind(std_functor(std::plus<int>()), _1, _2)(i, i);124 bl::bind(std_functor(std::plus<int>()), _1, _2)(i, i); 124 125 } 125 126 126 127 -
bind_tests_simple.cpp
18 18 19 19 #include <iostream> 20 20 21 using namespace boost::lambda; 21 22 22 using namespace std;23 using namespace boost::lambda;24 23 25 26 24 int sum_of_args_0() { return 0; } 27 25 int sum_of_args_1(int a) { return a; } 28 26 int sum_of_args_2(int a, int b) { return a+b; } -
bind_tests_simple_f_refs.cpp
18 18 19 19 #include <iostream> 20 20 21 using namespace boost::lambda; 21 22 22 using namespace std;23 using namespace boost::lambda;24 23 25 26 24 int sum_of_args_0() { return 0; } 27 25 int sum_of_args_1(int a) { return a; } 28 26 int sum_of_args_2(int a, int b) { return a+b; } -
constructor_tests.cpp
29 29 #endif 30 30 31 31 using namespace boost::lambda; 32 namespace bl = boost::lambda; 32 33 33 34 template<class T> 34 35 bool check_tuple(int n, const T& t) … … 248 249 std::vector<std::pair<int, int> > v; 249 250 250 251 std::transform(x.begin(), x.end(), y.begin(), std::back_inserter(v), 251 b ind(constructor<std::pair<int, int> >(), _1, _2) );252 bl::bind(constructor<std::pair<int, int> >(), _1, _2) ); 252 253 } 253 254 254 255 int test_main(int, char *[]) {