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 | |
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 | |
32 | bool f( bool v ) |
33 | { |
34 | return v; |
35 | } |
36 | |
37 | int g( int v ) |
38 | { |
39 | return v; |
40 | } |
41 | |
42 | int main() |
43 | { |
44 | test( f: !boost::bind( f, a1: true ), a1: 0, r: !f( v: true ) ); |
45 | test( f: !boost::bind( f: g, a1: _1 ), a1: 5, r: !g( v: 5 ) ); |
46 | test( f: boost::bind( f, a1: !boost::bind( f, a1: true ) ), a1: 0, r: f( v: !f( v: true ) ) ); |
47 | test( f: boost::bind( f, a1: !boost::bind( f, a1: _1 ) ), a1: true, r: f( v: !f( v: true ) ) ); |
48 | |
49 | return boost::report_errors(); |
50 | } |
51 | |