bind_unary_addr.cpp 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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. //
  9. // bind_unary_addr.cpp
  10. //
  11. // Copyright (c) 2005 Peter Dimov
  12. //
  13. // Distributed under the Boost Software License, Version 1.0. (See
  14. // accompanying file LICENSE_1_0.txt or copy at
  15. // http://www.boost.org/LICENSE_1_0.txt)
  16. //
  17. #include <boost/bind.hpp>
  18. #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
  19. #pragma warning(push, 3)
  20. #endif
  21. #include <iostream>
  22. #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
  23. #pragma warning(pop)
  24. #endif
  25. class X
  26. {
  27. private:
  28. void operator& ();
  29. void operator& () const;
  30. public:
  31. void operator()()
  32. {
  33. }
  34. void operator()() const
  35. {
  36. }
  37. void operator()(int)
  38. {
  39. }
  40. void operator()(int) const
  41. {
  42. }
  43. void operator()(int, int)
  44. {
  45. }
  46. void operator()(int, int) const
  47. {
  48. }
  49. void operator()(int, int, int)
  50. {
  51. }
  52. void operator()(int, int, int) const
  53. {
  54. }
  55. void operator()(int, int, int, int)
  56. {
  57. }
  58. void operator()(int, int, int, int) const
  59. {
  60. }
  61. void operator()(int, int, int, int, int)
  62. {
  63. }
  64. void operator()(int, int, int, int, int) const
  65. {
  66. }
  67. void operator()(int, int, int, int, int, int)
  68. {
  69. }
  70. void operator()(int, int, int, int, int, int) const
  71. {
  72. }
  73. void operator()(int, int, int, int, int, int, int)
  74. {
  75. }
  76. void operator()(int, int, int, int, int, int, int) const
  77. {
  78. }
  79. void operator()(int, int, int, int, int, int, int, int)
  80. {
  81. }
  82. void operator()(int, int, int, int, int, int, int, int) const
  83. {
  84. }
  85. void operator()(int, int, int, int, int, int, int, int, int)
  86. {
  87. }
  88. void operator()(int, int, int, int, int, int, int, int, int) const
  89. {
  90. }
  91. };
  92. template<class F> void test_const( F const & f )
  93. {
  94. f();
  95. }
  96. template<class F> void test( F f )
  97. {
  98. f();
  99. test_const( f );
  100. }
  101. int main()
  102. {
  103. test( boost::bind<void>( X() ) );
  104. test( boost::bind<void>( X(), 1 ) );
  105. test( boost::bind<void>( X(), 1, 2 ) );
  106. test( boost::bind<void>( X(), 1, 2, 3 ) );
  107. test( boost::bind<void>( X(), 1, 2, 3, 4 ) );
  108. test( boost::bind<void>( X(), 1, 2, 3, 4, 5 ) );
  109. test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6 ) );
  110. test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7 ) );
  111. test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7, 8 ) );
  112. test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7, 8, 9 ) );
  113. return 0;
  114. }