Skip to content

Commit

Permalink
Add shared_ptr 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 4767d62 commit e728e25
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/mem_fn_dm_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

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

Expand Down Expand Up @@ -59,5 +60,14 @@ int main()
// boost::mem_fn( &X::m )( boost::ref( x ) ) = 704;
// BOOST_TEST_EQ( x.m, 704 );

boost::shared_ptr<X> sp( new X() );
boost::shared_ptr<X const> csp( sp );

BOOST_TEST_EQ( boost::mem_fn( &X::m )( sp ), 0 );
BOOST_TEST_EQ( boost::mem_fn( &X::m )( csp ), 0 );

// boost::mem_fn( &X::m )( sp ) = 805;
// BOOST_TEST_EQ( x.m, 805 );

return boost::report_errors();
}

0 comments on commit e728e25

Please sign in to comment.