From Jason Turner

[util.smartptr.hash]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp_dvso6tb/{from.md → to.md} +9 -12
tmp/tmp_dvso6tb/{from.md → to.md} RENAMED
@@ -2,23 +2,20 @@
2
 
3
  ``` cpp
4
  template <class T, class D> struct hash<unique_ptr<T, D>>;
5
  ```
6
 
7
- The template specialization shall meet the requirements of class
8
- template `hash` ([[unord.hash]]). For an object `p` of type `UP`, where
9
- `UP` is `unique_ptr<T, D>`, `hash<UP>()(p)` shall evaluate to the same
10
- value as `hash<typename UP::pointer>()(p.get())`.
11
-
12
- *Requires:* The specialization `hash<typename UP::pointer>` shall be
13
- well-formed and well-defined, and shall meet the requirements of class
14
- template `hash` ([[unord.hash]]).
15
 
16
  ``` cpp
17
  template <class T> struct hash<shared_ptr<T>>;
18
  ```
19
 
20
- The template specialization shall meet the requirements of class
21
- template `hash` ([[unord.hash]]). For an object `p` of type
22
- `shared_ptr<T>`, `hash<shared_ptr<T> >()(p)` shall evaluate to the same
23
- value as `hash<T*>()(p.get())`.
24
 
 
2
 
3
  ``` cpp
4
  template <class T, class D> struct hash<unique_ptr<T, D>>;
5
  ```
6
 
7
+ Letting `UP` be `unique_ptr<T,D>`, the specialization `hash<UP>` is
8
+ enabled ([[unord.hash]]) if and only if `hash<typename UP::pointer>` is
9
+ enabled. When enabled, for an object `p` of type `UP`, `hash<UP>()(p)`
10
+ shall evaluate to the same value as
11
+ `hash<typename UP::pointer>()(p.get())`. The member functions are not
12
+ guaranteed to be `noexcept`.
 
 
13
 
14
  ``` cpp
15
  template <class T> struct hash<shared_ptr<T>>;
16
  ```
17
 
18
+ For an object `p` of type `shared_ptr<T>`, `hash<shared_ptr<T>>()(p)`
19
+ shall evaluate to the same value as
20
+ `hash<typename shared_ptr<T>::element_type*>()(p.get())`.
 
21