Ticket #3012: function.patch
File function.patch, 1.8 KB (added by , 13 years ago) |
---|
-
function_test.cpp
13 13 #include <string> 14 14 #include <utility> 15 15 16 using namespace boost;17 using namespace std;16 using boost::function; 17 using std::string; 18 18 19 19 int global_int; 20 20 … … 525 525 static void 526 526 test_one_arg() 527 527 { 528 negate<int> neg;528 std::negate<int> neg; 529 529 530 530 function<int (int)> f1(neg); 531 531 BOOST_CHECK(f1(5) == -5); … … 607 607 608 608 add_with_throw_on_copy(const add_with_throw_on_copy&) 609 609 { 610 throw runtime_error("But this CAN'T throw");610 throw std::runtime_error("But this CAN'T throw"); 611 611 } 612 612 613 613 add_with_throw_on_copy& operator=(const add_with_throw_on_copy&) 614 614 { 615 throw runtime_error("But this CAN'T throw");615 throw std::runtime_error("But this CAN'T throw"); 616 616 } 617 617 }; 618 618 … … 621 621 { 622 622 add_with_throw_on_copy atc; 623 623 try { 624 boost::function<int (int, int)> f( ref(atc));624 boost::function<int (int, int)> f(boost::ref(atc)); 625 625 BOOST_CHECK(f(1, 3) == 4); 626 626 } 627 catch( runtime_error e) {627 catch(std::runtime_error e) { 628 628 BOOST_ERROR("Nonthrowing constructor threw an exception"); 629 629 } 630 630 } -
lambda_test.cpp
16 16 #include <boost/function.hpp> 17 17 18 18 using namespace std; 19 using namespace boost;20 19 using namespace boost::lambda; 21 20 22 21 static unsigned … … 27 26 28 27 int test_main(int, char*[]) 29 28 { 29 using boost::function; 30 30 31 function <unsigned(bool, double)> f1 = bind(func_impl, 15, _1, _2); 31 32 function <unsigned(double)> f2 = bind(f1, false, _1); 32 33 function <unsigned()> f3 = bind(f2, 4.0);