1#include <boost/config.hpp>
2
3#ifndef BOOST_MSVC
4
5int main()
6{
7}
8
9#else
10
11//
12// mem_fn_stdcall_ref_test.cpp - reference_wrapper, stdcall
13//
14// Copyright 2009, 2024 Peter Dimov
15//
16// Distributed under the Boost Software License, Version 1.0.
17// See accompanying file LICENSE_1_0.txt or copy at
18// http://www.boost.org/LICENSE_1_0.txt
19//
20
21#define BOOST_MEM_FN_ENABLE_STDCALL
22
23#include <boost/mem_fn.hpp>
24#include <boost/ref.hpp>
25#include <boost/core/lightweight_test.hpp>
26
27struct X
28{
29 int __stdcall f0() { return 1; }
30 int __stdcall g0() const { return -1; }
31
32 int __stdcall f1( int x1 ) { return x1; }
33 int __stdcall g1( int x1 ) const { return -x1; }
34
35 int __stdcall f2( int x1, int x2 ) { return x1+x2; }
36 int __stdcall g2( int x1, int x2 ) const { return -x1-x2; }
37
38 int __stdcall f3( int x1, int x2, int x3 ) { return x1+x2+x3; }
39 int __stdcall g3( int x1, int x2, int x3 ) const { return -x1-x2-x3; }
40};
41
42int main()
43{
44 X x;
45
46 BOOST_TEST_EQ( boost::mem_fn( &X::f0 )( boost::ref( x ) ), 1 );
47 BOOST_TEST_EQ( boost::mem_fn( &X::g0 )( boost::cref( x ) ), -1 );
48
49 BOOST_TEST_EQ( boost::mem_fn( &X::f1 )( boost::ref( x ), 1 ), 1 );
50 BOOST_TEST_EQ( boost::mem_fn( &X::g1 )( boost::cref( x ), 1 ), -1 );
51
52 BOOST_TEST_EQ( boost::mem_fn( &X::f2 )( boost::ref( x ), 1, 2 ), 1+2 );
53 BOOST_TEST_EQ( boost::mem_fn( &X::g2 )( boost::cref( x ), 1, 2 ), -1-2 );
54
55 BOOST_TEST_EQ( boost::mem_fn( &X::f3 )( boost::ref( x ), 1, 2, 3 ), 1+2+3 );
56 BOOST_TEST_EQ( boost::mem_fn( &X::g3 )( boost::cref( x ), 1, 2, 3 ), -1-2-3 );
57
58 return boost::report_errors();
59}
60
61#endif
62

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