diff --git a/include/boost/function/function_base.hpp b/include/boost/function/function_base.hpp index f7470d3..0ea7604 100644 --- a/include/boost/function/function_base.hpp +++ b/include/boost/function/function_base.hpp @@ -330,7 +330,7 @@ namespace boost { bool compare_equal(const Function& f, const Functor& g, mpl::bool_) { - if (const Functor* fp = f.template contains()) + if (const Functor* fp = f.template target()) return *fp == g; else return false; } @@ -340,7 +340,7 @@ namespace boost { compare_not_equal(const Function& f, const Functor& g, mpl::bool_) { - if (const Functor* fp = f.template contains()) + if (const Functor* fp = f.template target()) return *fp != g; else return true; } @@ -366,7 +366,7 @@ public: bool empty() const { return !manager; } template - Functor* contains() + Functor* target() { if (!manager) return 0; @@ -381,7 +381,7 @@ public: } template - const Functor* contains() const + const Functor* target() const { if (!manager) return 0; diff --git a/include/boost/function/function_template.hpp b/include/boost/function/function_template.hpp index 89d09fa..b8b4fc4 100644 --- a/include/boost/function/function_template.hpp +++ b/include/boost/function/function_template.hpp @@ -648,7 +648,7 @@ template& f, Functor g) { - if (const Functor* fp = f.template contains()) return *fp == g; + if (const Functor* fp = f.template target()) return *fp == g; else return false; } @@ -661,7 +661,7 @@ template& f) { - if (const Functor* fp = f.template contains()) return g == *fp; + if (const Functor* fp = f.template target()) return g == *fp; else return false; } @@ -674,7 +674,7 @@ template& f, Functor g) { - if (const Functor* fp = f.template contains()) return *fp != g; + if (const Functor* fp = f.template target()) return *fp != g; else return true; } @@ -687,7 +687,7 @@ template& f) { - if (const Functor* fp = f.template contains()) return g != *fp; + if (const Functor* fp = f.template target()) return g != *fp; else return true; } #undef BOOST_FUNCTION_ENABLE_IF_NOT_INTEGRAL diff --git a/test/contains_test.cpp b/test/contains_test.cpp index b9ee1a3..601828c 100644 --- a/test/contains_test.cpp +++ b/test/contains_test.cpp @@ -31,23 +31,23 @@ bool operator==(const ReturnInt& x, const ReturnInt& y) bool operator!=(const ReturnInt& x, const ReturnInt& y) { return x.value != y.value; } -static void contains_test() +static void target_test() { boost::function0 f; f = &forty_two; - BOOST_TEST(*f.contains() == &forty_two); - BOOST_TEST(!f.contains()); + BOOST_TEST(*f.target() == &forty_two); + BOOST_TEST(!f.target()); f = Seventeen(); - BOOST_TEST(!f.contains()); - BOOST_TEST(f.contains()); + BOOST_TEST(!f.target()); + BOOST_TEST(f.target()); Seventeen this_seventeen; f = boost::ref(this_seventeen); - BOOST_TEST(!f.contains()); - BOOST_TEST(f.contains()); - BOOST_TEST(f.contains() == &this_seventeen); + BOOST_TEST(!f.target()); + BOOST_TEST(f.target()); + BOOST_TEST(f.target() == &this_seventeen); } static void equal_test() @@ -89,7 +89,7 @@ static void equal_test() int test_main(int, char*[]) { - contains_test(); + target_test(); equal_test(); return 0;