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 #include <boost/phoenix/operator.hpp>
22 
23 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
24 #pragma warning(push, 3)
25 #endif
26 
27 #include <iostream>
28 
29 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
30 #pragma warning(pop)
31 #endif
32 
33 #include <boost/detail/lightweight_test.hpp>
34 
tester(F f,A1 a1,R r)35 template<class F, class A1, class R> void tester( F f, A1 a1, R r )
36 {
37     BOOST_TEST( f(a1) == r );
38 }
39 
f(bool v)40 bool f( bool v )
41 {
42     return v;
43 }
44 
g(int v)45 int g( int v )
46 {
47     return v;
48 }
49 
main()50 int main()
51 {
52     using boost::phoenix::bind;
53     using boost::phoenix::placeholders::_1;
54 
55     tester( !bind( f, true ), 0, !f( true ) );
56     tester( !bind( g, _1 ), 5, !g( 5 ) );
57     tester( bind( f, !bind( f, true ) ), 0, f( !f( true ) ) );
58     tester( bind( f, !bind( f, _1 ) ), true, f( !f( true ) ) );
59 
60     return boost::report_errors();
61 }
62