diff --git a/src/signal_base.cpp b/src/signal_base.cpp index 759672d..432b5e9 100644 --- a/src/signal_base.cpp +++ b/src/signal_base.cpp @@ -72,7 +72,16 @@ namespace boost { // Allocate storage for an iterator that will hold the point of // insertion of the slot into the list. This is used to later remove // the slot when it is disconnected. + +#if defined(BOOST_NO_CXX11_SMART_PTR) + std::auto_ptr saved_iter(new iterator); + +#else + + std::unique_ptr saved_iter(new iterator); + +#endif // Add the slot to the list. iterator pos = @@ -133,7 +142,16 @@ namespace boost { signal_base_impl* self = reinterpret_cast(obj); // We won't need the slot iterator after this + +#if defined(BOOST_NO_CXX11_SMART_PTR) + std::auto_ptr slot(reinterpret_cast(data)); + +#else + + std::unique_ptr slot(reinterpret_cast(data)); + +#endif // If we're flags.clearing, we don't bother updating the list of slots if (!self->flags.clearing) { diff --git a/test/signal_n_test.cpp b/test/signal_n_test.cpp index 78ec0fa..f8e749d 100644 --- a/test/signal_n_test.cpp +++ b/test/signal_n_test.cpp @@ -125,7 +125,16 @@ test_one_arg() boost::signal1 > s1; s1.connect(std::negate()); + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + s1.connect(std::bind1st(std::multiplies(), 2)); + +#else + + s1.connect(std::bind(std::multiplies(), 2, std::placeholders::_1)); + +#endif BOOST_CHECK(s1(1) == 2); BOOST_CHECK(s1(-1) == 1); @@ -143,8 +152,18 @@ test_signal_signal_connect() { boost::signal1 > s2; s1.connect(s2); + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + s2.connect(std::bind1st(std::multiplies(), 2)); s2.connect(std::bind1st(std::multiplies(), -3)); + +#else + + s2.connect(std::bind(std::multiplies(), 2, std::placeholders::_1)); + s2.connect(std::bind(std::multiplies(), -3, std::placeholders::_1)); + +#endif BOOST_CHECK(s2(-3) == 9); BOOST_CHECK(s1(3) == 6); diff --git a/test/signal_test.cpp b/test/signal_test.cpp index 02a820a..3e616f8 100644 --- a/test/signal_test.cpp +++ b/test/signal_test.cpp @@ -123,7 +123,16 @@ test_one_arg() boost::signal > s1; s1.connect(std::negate()); + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + s1.connect(std::bind1st(std::multiplies(), 2)); + +#else + + s1.connect(std::bind(std::multiplies(), 2, std::placeholders::_1)); + +#endif BOOST_CHECK(s1(1) == 2); BOOST_CHECK(s1(-1) == 1); @@ -141,8 +150,18 @@ test_signal_signal_connect() { boost::signal > s2; s1.connect(s2); + +#if defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) + s2.connect(std::bind1st(std::multiplies(), 2)); s2.connect(std::bind1st(std::multiplies(), -3)); + +#else + + s2.connect(std::bind(std::multiplies(), 2, std::placeholders::_1)); + s2.connect(std::bind(std::multiplies(), -3, std::placeholders::_1)); + +#endif BOOST_CHECK(s2(-3) == 9); BOOST_CHECK(s1(3) == 6);