Brian Silverman | ce4aa8d | 2018-08-04 23:36:03 -0700 | [diff] [blame^] | 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_eq2_test.cpp - boost::bind equality operator |
| 12 | // |
| 13 | // Copyright (c) 2004, 2005, 2009 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 | #include <boost/function_equal.hpp> |
| 22 | #include <boost/detail/lightweight_test.hpp> |
| 23 | |
| 24 | void f( int ) |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | int g( int i ) |
| 29 | { |
| 30 | return i + 5; |
| 31 | } |
| 32 | |
| 33 | template< class F > void test_self_equal( F f ) |
| 34 | { |
| 35 | #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP |
| 36 | using boost::function_equal; |
| 37 | #endif |
| 38 | |
| 39 | BOOST_TEST( function_equal( f, f ) ); |
| 40 | } |
| 41 | |
| 42 | int main() |
| 43 | { |
| 44 | test_self_equal( boost::bind( f, _1 ) ); |
| 45 | test_self_equal( boost::bind( g, _1 ) ); |
| 46 | test_self_equal( boost::bind( f, boost::bind( g, _1 ) ) ); |
| 47 | |
| 48 | return boost::report_errors(); |
| 49 | } |