bind_eq2_test.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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/detail/lightweight_test.hpp>
  19. void f( int )
  20. {
  21. }
  22. int g( int i )
  23. {
  24. return i + 5;
  25. }
  26. template< class F > void test_self_equal( F f )
  27. {
  28. #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
  29. using boost::function_equal;
  30. #endif
  31. BOOST_TEST( function_equal( f, f ) );
  32. }
  33. int main()
  34. {
  35. using boost::phoenix::bind;
  36. using boost::phoenix::placeholders::_1;
  37. test_self_equal( bind( f, _1 ) );
  38. test_self_equal( bind( g, _1 ) );
  39. test_self_equal( bind( f, bind( g, _1 ) ) );
  40. return boost::report_errors();
  41. }