Ticket #3012: function.patch

File function.patch, 1.8 KB (added by Richard Webb <richard.webb@…>, 13 years ago)
  • function_test.cpp

     
    1313#include <string>
    1414#include <utility>
    1515
    16 using namespace boost;
    17 using namespace std;
     16using boost::function;
     17using std::string;
    1818
    1919int global_int;
    2020
     
    525525static void
    526526test_one_arg()
    527527{
    528   negate<int> neg;
     528  std::negate<int> neg;
    529529
    530530  function<int (int)> f1(neg);
    531531  BOOST_CHECK(f1(5) == -5);
     
    607607
    608608  add_with_throw_on_copy(const add_with_throw_on_copy&)
    609609  {
    610     throw runtime_error("But this CAN'T throw");
     610    throw std::runtime_error("But this CAN'T throw");
    611611  }
    612612
    613613  add_with_throw_on_copy& operator=(const add_with_throw_on_copy&)
    614614  {
    615     throw runtime_error("But this CAN'T throw");
     615    throw std::runtime_error("But this CAN'T throw");
    616616  }
    617617};
    618618
     
    621621{
    622622  add_with_throw_on_copy atc;
    623623  try {
    624     boost::function<int (int, int)> f(ref(atc));
     624    boost::function<int (int, int)> f(boost::ref(atc));
    625625    BOOST_CHECK(f(1, 3) == 4);
    626626  }
    627   catch(runtime_error e) {
     627  catch(std::runtime_error e) {
    628628    BOOST_ERROR("Nonthrowing constructor threw an exception");
    629629  }
    630630}
  • lambda_test.cpp

     
    1616#include <boost/function.hpp>
    1717
    1818using namespace std;
    19 using namespace boost;
    2019using namespace boost::lambda;
    2120
    2221static unsigned
     
    2726
    2827int test_main(int, char*[])
    2928{
     29  using boost::function;
     30
    3031  function <unsigned(bool, double)> f1 = bind(func_impl, 15, _1, _2);
    3132  function <unsigned(double)>       f2 = bind(f1, false, _1);
    3233  function <unsigned()>             f3 = bind(f2, 4.0);