bind_dm3_test.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*==============================================================================
  2. Copyright (c) 2005 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. #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
  18. #pragma warning(push, 3)
  19. #endif
  20. #include <iostream>
  21. #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
  22. #pragma warning(pop)
  23. #endif
  24. #include <boost/detail/lightweight_test.hpp>
  25. #include <utility>
  26. int main()
  27. {
  28. using boost::phoenix::bind;
  29. using boost::phoenix::placeholders::_1;
  30. typedef std::pair<int, int> pair_type;
  31. pair_type pair( 10, 20 );
  32. #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) && (BOOST_MSVC < 1700)
  33. // bind is being confused with 'std::tr1::_Bind' to be found here
  34. // C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxbind1(485)
  35. int const & x = boost::phoenix::bind( &pair_type::first, _1 )( pair );
  36. #else
  37. int const & x = bind( &pair_type::first, _1 )( pair );
  38. #endif
  39. BOOST_TEST( &pair.first == &x );
  40. return boost::report_errors();
  41. }