]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Function library |
2 | ||
3 | // Copyright (C) 2001-2003 Douglas Gregor | |
4 | ||
5 | // Use, modification and distribution is subject to the Boost Software | |
6 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
7 | // http://www.boost.org/LICENSE_1_0.txt) | |
8 | ||
9 | // For more information, see http://www.boost.org/ | |
10 | ||
1e59de90 TL |
11 | #if defined(__clang__) && defined(__has_warning) |
12 | # if __has_warning( "-Wdeprecated-declarations" ) | |
13 | # pragma clang diagnostic ignored "-Wdeprecated-declarations" | |
14 | # endif | |
15 | #endif | |
16 | ||
7c673cae FG |
17 | #include <boost/function.hpp> |
18 | #include <iostream> | |
19 | #include <functional> | |
20 | ||
21 | struct X { | |
22 | int foo(int); | |
23 | }; | |
24 | int X::foo(int x) { return -x; } | |
25 | ||
26 | int main() | |
27 | { | |
b32b8144 | 28 | #ifndef BOOST_NO_CXX98_BINDERS |
7c673cae FG |
29 | boost::function1<int, int> f; |
30 | X x; | |
31 | f = std::bind1st( | |
32 | std::mem_fun(&X::foo), &x); | |
33 | f(5); // Call x.foo(5) | |
b32b8144 | 34 | #endif |
7c673cae FG |
35 | return 0; |
36 | } |