Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52765 - sandbox/boost0x/libs/function/test
From: dgregor_at_[hidden]
Date: 2009-05-05 01:11:41


Author: dgregor
Date: 2009-05-05 01:11:39 EDT (Tue, 05 May 2009)
New Revision: 52765
URL: http://svn.boost.org/trac/boost/changeset/52765

Log:
Don't use 'using namespace std', since it causes problems in C++0x mode. Fix from Brad King
Text files modified:
   sandbox/boost0x/libs/function/test/allocator_test.cpp | 1 -
   sandbox/boost0x/libs/function/test/function_test.cpp | 20 ++++++++++----------
   sandbox/boost0x/libs/function/test/function_test_fail1.cpp | 1 -
   sandbox/boost0x/libs/function/test/function_test_fail2.cpp | 1 -
   sandbox/boost0x/libs/function/test/lambda_test.cpp | 1 -
   5 files changed, 10 insertions(+), 14 deletions(-)

Modified: sandbox/boost0x/libs/function/test/allocator_test.cpp
==============================================================================
--- sandbox/boost0x/libs/function/test/allocator_test.cpp (original)
+++ sandbox/boost0x/libs/function/test/allocator_test.cpp 2009-05-05 01:11:39 EDT (Tue, 05 May 2009)
@@ -12,7 +12,6 @@
 #include <functional>
 #include <boost/function.hpp>
 
-using namespace std;
 using namespace boost;
 
 static int alloc_count = 0;

Modified: sandbox/boost0x/libs/function/test/function_test.cpp
==============================================================================
--- sandbox/boost0x/libs/function/test/function_test.cpp (original)
+++ sandbox/boost0x/libs/function/test/function_test.cpp 2009-05-05 01:11:39 EDT (Tue, 05 May 2009)
@@ -14,7 +14,6 @@
 #include <utility>
 
 using namespace boost;
-using namespace std;
 
 int global_int;
 
@@ -26,8 +25,8 @@
 struct generate_three_obj { int operator()() const { return 3; } };
 static int generate_five() { return 5; }
 static int generate_three() { return 3; }
-static string identity_str(const string& s) { return s; }
-static string string_cat(const string& s1, const string& s2) { return s1+s2; }
+static std::string identity_str(const std::string& s) { return s; }
+static std::string string_cat(const std::string& s1, const std::string& s2) { return s1+s2; }
 static int sum_ints(int x, int y) { return x+y; }
 
 struct write_const_1_nonconst_2
@@ -525,15 +524,15 @@
 static void
 test_one_arg()
 {
- negate<int> neg;
+ std::negate<int> neg;
 
   function<int (int)> f1(neg);
   BOOST_CHECK(f1(5) == -5);
 
- function<string (string)> id(&identity_str);
+ function<std::string (std::string)> id(&identity_str);
   BOOST_CHECK(id("str") == "str");
 
- function<string (const char*)> id2(&identity_str);
+ function<std::string (const char*)> id2(&identity_str);
   BOOST_CHECK(id2("foo") == "foo");
 
   add_to_obj add_to(5);
@@ -547,7 +546,8 @@
 static void
 test_two_args()
 {
- function<string (const string&, const string&)> cat(&string_cat);
+ function<std::string (const std::string&, const std::string&)>
+ cat(&string_cat);
   BOOST_CHECK(cat("str", "ing") == "string");
 
   function<int (short, short)> sum(&sum_ints);
@@ -607,12 +607,12 @@
 
   add_with_throw_on_copy(const add_with_throw_on_copy&)
   {
- throw runtime_error("But this CAN'T throw");
+ throw std::runtime_error("But this CAN'T throw");
   }
 
   add_with_throw_on_copy& operator=(const add_with_throw_on_copy&)
   {
- throw runtime_error("But this CAN'T throw");
+ throw std::runtime_error("But this CAN'T throw");
   }
 };
 
@@ -624,7 +624,7 @@
     boost::function<int (int, int)> f(ref(atc));
     BOOST_CHECK(f(1, 3) == 4);
   }
- catch(runtime_error e) {
+ catch(std::runtime_error e) {
     BOOST_ERROR("Nonthrowing constructor threw an exception");
   }
 }

Modified: sandbox/boost0x/libs/function/test/function_test_fail1.cpp
==============================================================================
--- sandbox/boost0x/libs/function/test/function_test_fail1.cpp (original)
+++ sandbox/boost0x/libs/function/test/function_test_fail1.cpp 2009-05-05 01:11:39 EDT (Tue, 05 May 2009)
@@ -10,7 +10,6 @@
 #include <boost/test/minimal.hpp>
 #include <boost/function.hpp>
 
-using namespace std;
 using namespace boost;
 
 int

Modified: sandbox/boost0x/libs/function/test/function_test_fail2.cpp
==============================================================================
--- sandbox/boost0x/libs/function/test/function_test_fail2.cpp (original)
+++ sandbox/boost0x/libs/function/test/function_test_fail2.cpp 2009-05-05 01:11:39 EDT (Tue, 05 May 2009)
@@ -10,7 +10,6 @@
 #include <boost/test/minimal.hpp>
 #include <boost/function.hpp>
 
-using namespace std;
 using namespace boost;
 
 static int bad_fn(float f) { return static_cast<int>(f); }

Modified: sandbox/boost0x/libs/function/test/lambda_test.cpp
==============================================================================
--- sandbox/boost0x/libs/function/test/lambda_test.cpp (original)
+++ sandbox/boost0x/libs/function/test/lambda_test.cpp 2009-05-05 01:11:39 EDT (Tue, 05 May 2009)
@@ -15,7 +15,6 @@
 #include <boost/lambda/bind.hpp>
 #include <boost/function.hpp>
 
-using namespace std;
 using namespace boost;
 using namespace boost::lambda;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk