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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user