Skip to content

Commit

Permalink
Add ref(x) tests to mem_fn_dm_test
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Jan 4, 2024
1 parent 5a68a35 commit 4767d62
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions test/mem_fn_dm_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@
#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
// http://www.boost.org/LICENSE_1_0.txt)
//

#include <boost/mem_fn.hpp>
#include <boost/core/ref.hpp>
#include <boost/core/lightweight_test.hpp>

struct X
Expand Down Expand Up @@ -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();
}

0 comments on commit 4767d62

Please sign in to comment.