]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/ip_hash_test.cpp
4 // Copyright 2011 Peter Dimov
6 // Distributed under the Boost Software License, Version 1.0.
7 // See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt
11 #include <boost/intrusive_ptr.hpp>
12 #include <boost/functional/hash.hpp>
13 #include <boost/core/lightweight_test.hpp>
22 base
& operator=(base
const &);
36 long use_count() const
41 inline friend void intrusive_ptr_add_ref(base
* p
)
46 inline friend void intrusive_ptr_release(base
* p
)
48 if(--p
->use_count_
== 0) delete p
;
58 boost::hash
< boost::intrusive_ptr
<X
> > hasher
;
60 boost::intrusive_ptr
<X
> p1
, p2( p1
), p3( new X
), p4( p3
), p5( new X
);
62 BOOST_TEST_EQ( p1
, p2
);
63 BOOST_TEST_EQ( hasher( p1
), hasher( p2
) );
65 BOOST_TEST_NE( p1
, p3
);
66 BOOST_TEST_NE( hasher( p1
), hasher( p3
) );
68 BOOST_TEST_EQ( p3
, p4
);
69 BOOST_TEST_EQ( hasher( p3
), hasher( p4
) );
71 BOOST_TEST_NE( p3
, p5
);
72 BOOST_TEST_NE( hasher( p3
), hasher( p5
) );
74 return boost::report_errors();