Brian Silverman | ce4aa8d | 2018-08-04 23:36:03 -0700 | [diff] [blame^] | 1 | #include <boost/config.hpp> |
| 2 | |
| 3 | #if defined(BOOST_MSVC) |
| 4 | #pragma warning(disable: 4786) // identifier truncated in debug info |
| 5 | #pragma warning(disable: 4710) // function not inlined |
| 6 | #pragma warning(disable: 4711) // function selected for automatic inline expansion |
| 7 | #pragma warning(disable: 4514) // unreferenced inline removed |
| 8 | #endif |
| 9 | |
| 10 | // |
| 11 | // bind_unary_addr.cpp |
| 12 | // |
| 13 | // Copyright (c) 2005 Peter Dimov |
| 14 | // |
| 15 | // Distributed under the Boost Software License, Version 1.0. (See |
| 16 | // accompanying file LICENSE_1_0.txt or copy at |
| 17 | // http://www.boost.org/LICENSE_1_0.txt) |
| 18 | // |
| 19 | |
| 20 | #include <boost/bind.hpp> |
| 21 | |
| 22 | #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) |
| 23 | #pragma warning(push, 3) |
| 24 | #endif |
| 25 | |
| 26 | #include <iostream> |
| 27 | |
| 28 | #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) |
| 29 | #pragma warning(pop) |
| 30 | #endif |
| 31 | |
| 32 | class X |
| 33 | { |
| 34 | private: |
| 35 | |
| 36 | void operator& (); |
| 37 | void operator& () const; |
| 38 | |
| 39 | public: |
| 40 | |
| 41 | void operator()() |
| 42 | { |
| 43 | } |
| 44 | |
| 45 | void operator()() const |
| 46 | { |
| 47 | } |
| 48 | |
| 49 | void operator()(int) |
| 50 | { |
| 51 | } |
| 52 | |
| 53 | void operator()(int) const |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | void operator()(int, int) |
| 58 | { |
| 59 | } |
| 60 | |
| 61 | void operator()(int, int) const |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | void operator()(int, int, int) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | void operator()(int, int, int) const |
| 70 | { |
| 71 | } |
| 72 | |
| 73 | void operator()(int, int, int, int) |
| 74 | { |
| 75 | } |
| 76 | |
| 77 | void operator()(int, int, int, int) const |
| 78 | { |
| 79 | } |
| 80 | |
| 81 | void operator()(int, int, int, int, int) |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | void operator()(int, int, int, int, int) const |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | void operator()(int, int, int, int, int, int) |
| 90 | { |
| 91 | } |
| 92 | |
| 93 | void operator()(int, int, int, int, int, int) const |
| 94 | { |
| 95 | } |
| 96 | |
| 97 | void operator()(int, int, int, int, int, int, int) |
| 98 | { |
| 99 | } |
| 100 | |
| 101 | void operator()(int, int, int, int, int, int, int) const |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | void operator()(int, int, int, int, int, int, int, int) |
| 106 | { |
| 107 | } |
| 108 | |
| 109 | void operator()(int, int, int, int, int, int, int, int) const |
| 110 | { |
| 111 | } |
| 112 | |
| 113 | void operator()(int, int, int, int, int, int, int, int, int) |
| 114 | { |
| 115 | } |
| 116 | |
| 117 | void operator()(int, int, int, int, int, int, int, int, int) const |
| 118 | { |
| 119 | } |
| 120 | }; |
| 121 | |
| 122 | template<class F> void test_const( F const & f ) |
| 123 | { |
| 124 | f(); |
| 125 | } |
| 126 | |
| 127 | template<class F> void test( F f ) |
| 128 | { |
| 129 | f(); |
| 130 | test_const( f ); |
| 131 | } |
| 132 | |
| 133 | int main() |
| 134 | { |
| 135 | test( boost::bind<void>( X() ) ); |
| 136 | test( boost::bind<void>( X(), 1 ) ); |
| 137 | test( boost::bind<void>( X(), 1, 2 ) ); |
| 138 | test( boost::bind<void>( X(), 1, 2, 3 ) ); |
| 139 | test( boost::bind<void>( X(), 1, 2, 3, 4 ) ); |
| 140 | test( boost::bind<void>( X(), 1, 2, 3, 4, 5 ) ); |
| 141 | test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6 ) ); |
| 142 | test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7 ) ); |
| 143 | test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7, 8 ) ); |
| 144 | test( boost::bind<void>( X(), 1, 2, 3, 4, 5, 6, 7, 8, 9 ) ); |
| 145 | |
| 146 | return 0; |
| 147 | } |