From 58fee456999d3a21cf35ce20a75b752e9a0817bf Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 4 Jan 2024 18:44:49 +0200 Subject: [PATCH] Update mem_fn_dm_test --- test/mem_fn_dm_test.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/test/mem_fn_dm_test.cpp b/test/mem_fn_dm_test.cpp index 18a6234..e14e734 100644 --- a/test/mem_fn_dm_test.cpp +++ b/test/mem_fn_dm_test.cpp @@ -21,6 +21,7 @@ #include #include #include +#include struct X { @@ -57,17 +58,27 @@ int main() 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 ); +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1900) + + boost::mem_fn( &X::m )( boost::ref( x ) ) = 704; + BOOST_TEST_EQ( x.m, 704 ); + +#endif boost::shared_ptr sp( new X() ); boost::shared_ptr csp( sp ); - BOOST_TEST_EQ( boost::mem_fn( &X::m )( sp ), 0 ); - BOOST_TEST_EQ( boost::mem_fn( &X::m )( csp ), 0 ); + sp->m = 805; - // boost::mem_fn( &X::m )( sp ) = 805; - // BOOST_TEST_EQ( x.m, 805 ); + BOOST_TEST_EQ( boost::mem_fn( &X::m )( sp ), 805 ); + BOOST_TEST_EQ( boost::mem_fn( &X::m )( csp ), 805 ); + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1900) + + boost::mem_fn( &X::m )( sp ) = 906; + BOOST_TEST_EQ( sp->m, 906 ); + +#endif return boost::report_errors(); }