bind_eq3_test.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*==============================================================================
  2. Copyright (c) 2004, 2005, 2009 Peter Dimov
  3. Copyright (c) 2005-2010 Joel de Guzman
  4. Copyright (c) 2010 Thomas Heller
  5. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #include <boost/config.hpp>
  9. #if defined(BOOST_MSVC)
  10. #pragma warning(disable: 4786) // identifier truncated in debug info
  11. #pragma warning(disable: 4710) // function not inlined
  12. #pragma warning(disable: 4711) // function selected for automatic inline expansion
  13. #pragma warning(disable: 4514) // unreferenced inline removed
  14. #endif
  15. #include <boost/phoenix/core.hpp>
  16. #include <boost/phoenix/bind.hpp>
  17. #include <boost/function_equal.hpp>
  18. #include <boost/weak_ptr.hpp>
  19. #include <boost/detail/lightweight_test.hpp>
  20. int f( boost::weak_ptr<void> wp )
  21. {
  22. return wp.use_count();
  23. }
  24. template< class F > void test_self_equal( F f )
  25. {
  26. #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  27. using boost::function_equal;
  28. #endif
  29. BOOST_TEST( function_equal( f, f ) );
  30. }
  31. int main()
  32. {
  33. using boost::phoenix::bind;
  34. using boost::phoenix::placeholders::_1;
  35. test_self_equal( bind( f, _1 ) );
  36. test_self_equal( bind( f, boost::weak_ptr<void>() ) );
  37. return boost::report_errors();
  38. }