1
#include <boost/config.hpp>
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
11
// bind_function_test.cpp - function<>
13
// Copyright (c) 2005 Peter Dimov
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)
20
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
21
#pragma warning(push, 3)
25
#include <boost/function.hpp>
27
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
31
#include <boost/bind.hpp>
32
#include <boost/detail/lightweight_test.hpp>
46
boost::function0<int> fn;
48
BOOST_TEST( !fn.contains( boost::bind( f, 1 ) ) );
49
BOOST_TEST( !fn.contains( boost::bind( f, 2 ) ) );
50
BOOST_TEST( !fn.contains( boost::bind( g, 1 ) ) );
52
fn = boost::bind( f, 1 );
54
BOOST_TEST( fn() == 1 );
56
BOOST_TEST( fn.contains( boost::bind( f, 1 ) ) );
57
BOOST_TEST( !fn.contains( boost::bind( f, 2 ) ) );
58
BOOST_TEST( !fn.contains( boost::bind( g, 1 ) ) );
60
fn = boost::bind( f, 2 );
62
BOOST_TEST( fn() == 2 );
64
BOOST_TEST( !fn.contains( boost::bind( f, 1 ) ) );
65
BOOST_TEST( fn.contains( boost::bind( f, 2 ) ) );
66
BOOST_TEST( !fn.contains( boost::bind( g, 1 ) ) );
68
fn = boost::bind( g, 1 );
70
BOOST_TEST( fn() == 2 );
72
BOOST_TEST( !fn.contains( boost::bind( f, 1 ) ) );
73
BOOST_TEST( !fn.contains( boost::bind( f, 2 ) ) );
74
BOOST_TEST( fn.contains( boost::bind( g, 1 ) ) );
76
return boost::report_errors();