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 
21 #include <boost/bind.hpp>
22 #include <boost/ref.hpp>
23 
24 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
25 #pragma warning(push, 3)
26 #endif
27 
28 #include <iostream>
29 
30 #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
31 #pragma warning(pop)
32 #endif
33 
34 #include <boost/detail/lightweight_test.hpp>
35 
36 //
37 
38 struct Z
39 {
40     int m;
41 };
42 
member_data_test()43 void member_data_test()
44 {
45     Z z = { 17041 };
46     Z * pz = &z;
47 
48     boost::bind<void>( &Z::m, _1 )( z );
49     boost::bind<void>( &Z::m, _1 )( pz );
50 
51     boost::bind<void>( &Z::m, z )();
52     boost::bind<void>( &Z::m, pz )();
53     boost::bind<void>( &Z::m, boost::ref(z) )();
54 
55 
56     Z const cz = z;
57     Z const * pcz = &cz;
58 
59     boost::bind<void>( &Z::m, _1 )( cz );
60     boost::bind<void>( &Z::m, _1 )( pcz );
61 
62     boost::bind<void>( &Z::m, cz )();
63     boost::bind<void>( &Z::m, pcz )();
64     boost::bind<void>( &Z::m, boost::ref(cz) )();
65 }
66 
main()67 int main()
68 {
69     member_data_test();
70 
71     return boost::report_errors();
72 }
73