]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/weak_from_raw_test4.cpp
2 // weak_from_raw_test4.cpp
4 // As weak_from_raw_test2.cpp, but uses weak_from_raw
7 // Copyright (c) 2014, 2015 Peter Dimov
9 // Distributed under the Boost Software License, Version 1.0.
11 // See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt
15 #include <boost/smart_ptr/enable_shared_from_raw.hpp>
16 #include <boost/weak_ptr.hpp>
17 #include <boost/core/lightweight_test.hpp>
21 static boost::weak_ptr
< X
> r_
;
23 void register_( boost::weak_ptr
< X
> const & r
)
28 void check_( boost::weak_ptr
< X
> const & r
)
30 BOOST_TEST( !( r
< r_
) && !( r_
< r
) );
33 void unregister_( boost::weak_ptr
< X
> const & r
)
35 BOOST_TEST( !( r
< r_
) && !( r_
< r
) );
39 class X
: public boost::enable_shared_from_raw
45 register_( boost::weak_from_raw( this ) );
50 unregister_( boost::weak_from_raw( this ) );
55 check_( boost::weak_from_raw( this ) );
62 boost::shared_ptr
< X
> px( new X
);
66 return boost::report_errors();