2
0
mirror of https://github.com/boostorg/lambda.git synced 2026-01-26 18:42:16 +00:00

converting to the new boost::function style

[SVN r15508]
This commit is contained in:
Jaakko Järvi
2002-09-25 16:46:42 +00:00
parent e1b36955b7
commit 05b9bd64c4

View File

@@ -21,13 +21,13 @@ using namespace std;
void test_function() {
boost::function<int, int, int> f;
boost::function<int (int, int)> f;
f = _1 + _2;
BOOST_TEST(f(1, 2)== 3);
int i=1; int j=2;
boost::function<int&, int&, int> g = _1 += _2;
boost::function<int& (int&, int)> g = _1 += _2;
g(i, j);
BOOST_TEST(i==3);
@@ -35,7 +35,7 @@ void test_function() {
int* sum = new int();
*sum = 0;
boost::function<int&, int> counter = *sum += _1;
boost::function<int& (int)> counter = *sum += _1;
counter(5); // ok, sum* = 5;
BOOST_TEST(*sum == 5);
delete sum;