From 4767d6243de2eaca06df9a7b59d8cd6b576598bb Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 4 Jan 2024 17:36:49 +0200 Subject: [PATCH] Add ref(x) tests to mem_fn_dm_test --- test/mem_fn_dm_test.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/mem_fn_dm_test.cpp b/test/mem_fn_dm_test.cpp index d958ef0..c2298e7 100644 --- a/test/mem_fn_dm_test.cpp +++ b/test/mem_fn_dm_test.cpp @@ -8,9 +8,9 @@ #endif // -// mem_fn_dm_test.cpp - data members +// mem_fn_dm_test.cpp - data members // -// Copyright (c) 2005 Peter Dimov +// Copyright 2005, 2024 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -18,6 +18,7 @@ // #include +#include #include struct X @@ -52,5 +53,11 @@ int main() BOOST_TEST( boost::mem_fn( &X::m )( cx ) == 603 ); BOOST_TEST( boost::mem_fn( &X::m )( pcx ) == 603 ); + BOOST_TEST_EQ( boost::mem_fn( &X::m )( boost::ref( x ) ), 603 ); + BOOST_TEST_EQ( boost::mem_fn( &X::m )( boost::cref( x ) ), 603 ); + + // boost::mem_fn( &X::m )( boost::ref( x ) ) = 704; + // BOOST_TEST_EQ( x.m, 704 ); + return boost::report_errors(); }