]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_void_mf_test.cpp - test for bind<void> with member functions | |
12 | // | |
13 | // Copyright (c) 2008 Peter Dimov | |
14 | // Copyright (c) 2014 Agustin Berge | |
15 | // | |
16 | // Distributed under the Boost Software License, Version 1.0. (See | |
17 | // accompanying file LICENSE_1_0.txt or copy at | |
18 | // http://www.boost.org/LICENSE_1_0.txt) | |
19 | // | |
20 | ||
f67539c2 | 21 | #include <boost/bind/bind.hpp> |
7c673cae | 22 | #include <boost/ref.hpp> |
f67539c2 | 23 | #include <boost/core/lightweight_test.hpp> |
7c673cae | 24 | |
f67539c2 | 25 | using namespace boost::placeholders; |
7c673cae FG |
26 | |
27 | // | |
28 | ||
29 | struct Z | |
30 | { | |
31 | int m; | |
32 | }; | |
33 | ||
34 | void member_data_test() | |
35 | { | |
36 | Z z = { 17041 }; | |
37 | Z * pz = &z; | |
38 | ||
39 | boost::bind<void>( &Z::m, _1 )( z ); | |
40 | boost::bind<void>( &Z::m, _1 )( pz ); | |
41 | ||
42 | boost::bind<void>( &Z::m, z )(); | |
43 | boost::bind<void>( &Z::m, pz )(); | |
44 | boost::bind<void>( &Z::m, boost::ref(z) )(); | |
45 | ||
46 | ||
47 | Z const cz = z; | |
48 | Z const * pcz = &cz; | |
49 | ||
50 | boost::bind<void>( &Z::m, _1 )( cz ); | |
51 | boost::bind<void>( &Z::m, _1 )( pcz ); | |
52 | ||
53 | boost::bind<void>( &Z::m, cz )(); | |
54 | boost::bind<void>( &Z::m, pcz )(); | |
55 | boost::bind<void>( &Z::m, boost::ref(cz) )(); | |
56 | } | |
57 | ||
58 | int main() | |
59 | { | |
60 | member_data_test(); | |
61 | ||
62 | return boost::report_errors(); | |
63 | } |