| 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.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 | #include <boost/detail/lightweight_test.hpp> |
|---|
| 33 | |
|---|
| 34 | template<class F, class A1, class R> void test( F f, A1 a1, R r ) |
|---|
| 35 | { |
|---|
| 36 | BOOST_TEST( f(a1) == r ); |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | bool f( bool v ) |
|---|
| 40 | { |
|---|
| 41 | return v; |
|---|
| 42 | } |
|---|
| 43 | |
|---|
| 44 | int g( int v ) |
|---|
| 45 | { |
|---|
| 46 | return v; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | int main() |
|---|
| 50 | { |
|---|
| 51 | test( !boost::bind( f, true ), 0, !f( true ) ); |
|---|
| 52 | test( !boost::bind( g, _1 ), 5, !g( 5 ) ); |
|---|
| 53 | test( boost::bind( f, !boost::bind( f, true ) ), 0, f( !f( true ) ) ); |
|---|
| 54 | test( boost::bind( f, !boost::bind( f, _1 ) ), true, f( !f( true ) ) ); |
|---|
| 55 | |
|---|
| 56 | return boost::report_errors(); |
|---|
| 57 | } |
|---|