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/bind.hpp>
22#include <boost/ref.hpp>
23#include <boost/core/lightweight_test.hpp>
24
25using namespace boost::placeholders;
26
27//
28
29struct Z
30{
31 int m;
32};
33
34void member_data_test()
35{
36 Z z = { .m: 17041 };
37 Z * pz = &z;
38
39 boost::bind<void>( f: &Z::m, a1: _1 )( z );
40 boost::bind<void>( f: &Z::m, a1: _1 )( pz );
41
42 boost::bind<void>( f: &Z::m, a1: z )();
43 boost::bind<void>( f: &Z::m, a1: pz )();
44 boost::bind<void>( f: &Z::m, a1: boost::ref(t&: z) )();
45
46
47 Z const cz = z;
48 Z const * pcz = &cz;
49
50 boost::bind<void>( f: &Z::m, a1: _1 )( cz );
51 boost::bind<void>( f: &Z::m, a1: _1 )( pcz );
52
53 boost::bind<void>( f: &Z::m, a1: cz )();
54 boost::bind<void>( f: &Z::m, a1: pcz )();
55 boost::bind<void>( f: &Z::m, a1: boost::ref(t: cz) )();
56}
57
58int main()
59{
60 member_data_test();
61
62 return boost::report_errors();
63}
64

source code of boost/libs/bind/test/bind_void_dm_test.cpp