| 1 | /*============================================================================== |
| 2 | Copyright (c) 2005 Peter Dimov |
| 3 | Copyright (c) 2005-2010 Joel de Guzman |
| 4 | Copyright (c) 2010 Thomas Heller |
| 5 | |
| 6 | Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 7 | file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 8 | ==============================================================================*/ |
| 9 | |
| 10 | #include <boost/config.hpp> |
| 11 | |
| 12 | #if defined(BOOST_MSVC) |
| 13 | #pragma warning(disable: 4786) // identifier truncated in debug info |
| 14 | #pragma warning(disable: 4710) // function not inlined |
| 15 | #pragma warning(disable: 4711) // function selected for automatic inline expansion |
| 16 | #pragma warning(disable: 4514) // unreferenced inline removed |
| 17 | #endif |
| 18 | |
| 19 | #include <boost/phoenix/core.hpp> |
| 20 | #include <boost/phoenix/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 | typedef void result_type; |
| 42 | |
| 43 | void operator()() |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | void operator()() const |
| 48 | { |
| 49 | } |
| 50 | |
| 51 | void operator()(int) |
| 52 | { |
| 53 | } |
| 54 | |
| 55 | void operator()(int) const |
| 56 | { |
| 57 | } |
| 58 | |
| 59 | void operator()(int, int) |
| 60 | { |
| 61 | } |
| 62 | |
| 63 | void operator()(int, int) const |
| 64 | { |
| 65 | } |
| 66 | |
| 67 | void operator()(int, int, int) |
| 68 | { |
| 69 | } |
| 70 | |
| 71 | void operator()(int, int, int) const |
| 72 | { |
| 73 | } |
| 74 | |
| 75 | void operator()(int, int, int, int) |
| 76 | { |
| 77 | } |
| 78 | |
| 79 | void operator()(int, int, int, int) const |
| 80 | { |
| 81 | } |
| 82 | |
| 83 | void operator()(int, int, int, int, int) |
| 84 | { |
| 85 | } |
| 86 | |
| 87 | void operator()(int, int, int, int, int) const |
| 88 | { |
| 89 | } |
| 90 | |
| 91 | void operator()(int, int, int, int, int, int) |
| 92 | { |
| 93 | } |
| 94 | |
| 95 | void operator()(int, int, int, int, int, int) const |
| 96 | { |
| 97 | } |
| 98 | |
| 99 | void operator()(int, int, int, int, int, int, int) |
| 100 | { |
| 101 | } |
| 102 | |
| 103 | void operator()(int, int, int, int, int, int, int) const |
| 104 | { |
| 105 | } |
| 106 | |
| 107 | void operator()(int, int, int, int, int, int, int, int) |
| 108 | { |
| 109 | } |
| 110 | |
| 111 | void operator()(int, int, int, int, int, int, int, int) const |
| 112 | { |
| 113 | } |
| 114 | |
| 115 | void operator()(int, int, int, int, int, int, int, int, int) |
| 116 | { |
| 117 | } |
| 118 | |
| 119 | void operator()(int, int, int, int, int, int, int, int, int) const |
| 120 | { |
| 121 | } |
| 122 | }; |
| 123 | |
| 124 | template<class F> void test_const( F const & f ) |
| 125 | { |
| 126 | f(); |
| 127 | } |
| 128 | |
| 129 | template<class F> void test( F f ) |
| 130 | { |
| 131 | f(); |
| 132 | test_const( f ); |
| 133 | } |
| 134 | |
| 135 | int main() |
| 136 | { |
| 137 | using boost::phoenix::bind; |
| 138 | |
| 139 | test( f: bind( f: X() ) ); |
| 140 | test( f: bind( f: X(), a: 1 ) ); |
| 141 | test( f: bind( f: X(), a: 1, a: 2 ) ); |
| 142 | test( f: bind( f: X(), a: 1, a: 2, a: 3 ) ); |
| 143 | test( f: bind( f: X(), a: 1, a: 2, a: 3, a: 4 ) ); |
| 144 | test( f: bind( f: X(), a: 1, a: 2, a: 3, a: 4, a: 5 ) ); |
| 145 | test( f: bind( f: X(), a: 1, a: 2, a: 3, a: 4, a: 5, a: 6 ) ); |
| 146 | test( f: bind( f: X(), a: 1, a: 2, a: 3, a: 4, a: 5, a: 6, a: 7 ) ); |
| 147 | test( f: bind( f: X(), a: 1, a: 2, a: 3, a: 4, a: 5, a: 6, a: 7, a: 8 ) ); |
| 148 | test( f: bind( f: X(), a: 1, a: 2, a: 3, a: 4, a: 5, a: 6, a: 7, a: 8, a: 9 ) ); |
| 149 | |
| 150 | return 0; |
| 151 | } |
| 152 | |