• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_not_test.cpp - operator!
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/bind.hpp>
21 #include <boost/core/lightweight_test.hpp>
22 
23 using namespace boost::placeholders;
24 
25 //
26 
test(F f,A1 a1,R r)27 template<class F, class A1, class R> void test( F f, A1 a1, R r )
28 {
29     BOOST_TEST( f(a1) == r );
30 }
31 
f(bool v)32 bool f( bool v )
33 {
34     return v;
35 }
36 
g(int v)37 int g( int v )
38 {
39     return v;
40 }
41 
main()42 int main()
43 {
44     test( !boost::bind( f, true ), 0, !f( true ) );
45     test( !boost::bind( g, _1 ), 5, !g( 5 ) );
46     test( boost::bind( f, !boost::bind( f, true ) ), 0, f( !f( true ) ) );
47     test( boost::bind( f, !boost::bind( f, _1 ) ), true, f( !f( true ) ) );
48 
49     return boost::report_errors();
50 }
51