bind_rvalue_test.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #include <boost/config.hpp>
  2. #if defined( BOOST_MSVC )
  3. #pragma warning(disable: 4786) // identifier truncated in debug info
  4. #pragma warning(disable: 4710) // function not inlined
  5. #pragma warning(disable: 4711) // function selected for automatic inline expansion
  6. #pragma warning(disable: 4514) // unreferenced inline removed
  7. #endif
  8. // bind_rvalue_test.cpp
  9. //
  10. // Copyright (c) 2006 Peter Dimov
  11. //
  12. // Distributed under the Boost Software License, Version 1.0.
  13. //
  14. // See accompanying file LICENSE_1_0.txt or copy at
  15. // http://www.boost.org/LICENSE_1_0.txt)
  16. #include <boost/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. //
  26. int f( int x )
  27. {
  28. return x;
  29. }
  30. int main()
  31. {
  32. BOOST_TEST(
  33. boost::bind( f, _1 )
  34. ( 1 ) == 1 );
  35. BOOST_TEST(
  36. boost::bind( f, _2 )
  37. ( 1, 2 ) == 2 );
  38. BOOST_TEST(
  39. boost::bind( f, _3 )
  40. ( 1, 2, 3 ) == 3 );
  41. BOOST_TEST(
  42. boost::bind( f, _4 )
  43. ( 1, 2, 3, 4 ) == 4 );
  44. BOOST_TEST(
  45. boost::bind( f, _5 )
  46. ( 1, 2, 3, 4, 5 ) == 5 );
  47. BOOST_TEST(
  48. boost::bind( f, _6 )
  49. ( 1, 2, 3, 4, 5, 6 ) == 6 );
  50. BOOST_TEST(
  51. boost::bind( f, _7 )
  52. ( 1, 2, 3, 4, 5, 6, 7 ) == 7 );
  53. BOOST_TEST(
  54. boost::bind( f, _8 )
  55. ( 1, 2, 3, 4, 5, 6, 7, 8 ) == 8 );
  56. BOOST_TEST(
  57. boost::bind( f, _9 )
  58. ( 1, 2, 3, 4, 5, 6, 7, 8, 9 ) == 9 );
  59. return boost::report_errors();
  60. }