blob: be989414eb72326b0a7545368aa88423a10e2921 [file] [log] [blame]
Brian Silvermance4aa8d2018-08-04 23:36:03 -07001//
2// mem_fn_ref_test.cpp - reference_wrapper
3//
4// Copyright (c) 2009 Peter Dimov
5//
6// Distributed under the Boost Software License, Version 1.0.
7// See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt
9//
10
11#include <boost/mem_fn.hpp>
12#include <boost/ref.hpp>
13#include <boost/detail/lightweight_test.hpp>
14
15struct X
16{
17 int f()
18 {
19 return 1;
20 }
21
22 int g() const
23 {
24 return 2;
25 }
26};
27
28int main()
29{
30 X x;
31
32 BOOST_TEST( boost::mem_fn( &X::f )( boost::ref( x ) ) == 1 );
33 BOOST_TEST( boost::mem_fn( &X::g )( boost::cref( x ) ) == 2 );
34
35 return boost::report_errors();
36}