mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-09-25 15:21:02 +02:00
Update documentation
This commit is contained in:
@@ -37,6 +37,7 @@ include::smart_ptr/pointer_to_other.adoc[]
|
|||||||
include::smart_ptr/atomic_shared_ptr.adoc[]
|
include::smart_ptr/atomic_shared_ptr.adoc[]
|
||||||
include::smart_ptr/owner_less.adoc[]
|
include::smart_ptr/owner_less.adoc[]
|
||||||
include::smart_ptr/owner_equal_to.adoc[]
|
include::smart_ptr/owner_equal_to.adoc[]
|
||||||
|
include::smart_ptr/owner_hash.adoc[]
|
||||||
|
|
||||||
// appendix
|
// appendix
|
||||||
include::smart_ptr/techniques.adoc[]
|
include::smart_ptr/techniques.adoc[]
|
||||||
|
@@ -16,11 +16,11 @@ http://www.boost.org/LICENSE_1_0.txt
|
|||||||
## Changes in 1.74.0
|
## Changes in 1.74.0
|
||||||
|
|
||||||
* Added `owner_equals` to `shared_ptr`, `weak_ptr`, `local_shared_ptr`
|
* Added `owner_equals` to `shared_ptr`, `weak_ptr`, `local_shared_ptr`
|
||||||
* Added `owner_equal_to`
|
|
||||||
* Added `std::hash` specializations for `shared_ptr`, `local_shared_ptr`
|
|
||||||
* Added `owner_hash_value` to `shared_ptr`, `weak_ptr`
|
* Added `owner_hash_value` to `shared_ptr`, `weak_ptr`
|
||||||
* Added `boost::hash` support and `std::hash`, `std::equal_to`
|
* Added `owner_equal_to`, `owner_hash`
|
||||||
specializations for `weak_ptr`
|
* Added `std::hash` specializations for `shared_ptr`, `local_shared_ptr`
|
||||||
|
* Added `boost::hash` support to, and `std::hash`, `std::equal_to`
|
||||||
|
specializations for, `weak_ptr`
|
||||||
|
|
||||||
## Changes in 1.72.0
|
## Changes in 1.72.0
|
||||||
|
|
||||||
|
56
doc/smart_ptr/owner_hash.adoc
Normal file
56
doc/smart_ptr/owner_hash.adoc
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
////
|
||||||
|
Copyright 2020 Peter Dimov
|
||||||
|
Distributed under the Boost Software License, Version 1.0.
|
||||||
|
https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
////
|
||||||
|
|
||||||
|
[#owner_hash]
|
||||||
|
# owner_hash
|
||||||
|
:toc:
|
||||||
|
:toc-title:
|
||||||
|
:idprefix: owner_hash_to_
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
`owner_hash<T>` is a helper function object that takes a smart pointer `p`
|
||||||
|
and returns `p.owner_hash_value()`. It's useful for creating unordered
|
||||||
|
containers of `shared_ptr` that use ownership-based equality, instead of
|
||||||
|
the default pointer value equality. (It can be used with `weak_ptr` too,
|
||||||
|
but there's no need, because `boost::hash` and `std::hash` for `weak_ptr`
|
||||||
|
already use ownership-based equality.)
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```
|
||||||
|
std::unordered_set< boost::shared_ptr<void>,
|
||||||
|
boost::owner_hash< boost::shared_ptr<void> >,
|
||||||
|
boost::owner_equal_to< boost::shared_ptr<void> > > set;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Synopsis
|
||||||
|
|
||||||
|
`owner_hash` is defined in `<boost/smart_ptr/owner_hash.hpp>`.
|
||||||
|
|
||||||
|
```
|
||||||
|
namespace boost {
|
||||||
|
|
||||||
|
template<class T> struct owner_hash
|
||||||
|
{
|
||||||
|
typedef std::size_t result_type;
|
||||||
|
typedef T argument_type;
|
||||||
|
|
||||||
|
std::size_t operator()( T const & p ) const noexcept;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Members
|
||||||
|
|
||||||
|
```
|
||||||
|
std::size_t operator()( T const & p ) const noexcept;
|
||||||
|
```
|
||||||
|
[none]
|
||||||
|
* {blank}
|
||||||
|
+
|
||||||
|
Returns::
|
||||||
|
`p.owner_hash_value()`.
|
Reference in New Issue
Block a user