From Jason Turner

[util.smartptr.shared.cmp]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxprwcdew/{from.md → to.md} +10 -8
tmp/tmpxprwcdew/{from.md → to.md} RENAMED
@@ -1,22 +1,23 @@
1
  ##### `shared_ptr` comparison <a id="util.smartptr.shared.cmp">[[util.smartptr.shared.cmp]]</a>
2
 
3
  ``` cpp
4
- template<class T, class U> bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
 
5
  ```
6
 
7
  *Returns:* `a.get() == b.get()`.
8
 
9
  ``` cpp
10
- template<class T, class U> bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
 
11
  ```
12
 
13
- *Returns:* `less<V>()(a.get(), b.get())`, where `V` is the composite
14
- pointer type (Clause  [[expr]]) of `T*` and `U*`.
15
 
16
- Defining a comparison operator allows `shared_ptr` objects to be used as
17
- keys in associative containers.
18
 
19
  ``` cpp
20
  template <class T>
21
  bool operator==(const shared_ptr<T>& a, nullptr_t) noexcept;
22
  template <class T>
@@ -40,12 +41,13 @@ template <class T>
40
  template <class T>
41
  bool operator<(nullptr_t, const shared_ptr<T>& a) noexcept;
42
  ```
43
 
44
  *Returns:* The first function template returns
45
- `less<T*>()(a.get(), nullptr)`. The second function template returns
46
- `less<T*>()(nullptr, a.get())`.
 
47
 
48
  ``` cpp
49
  template <class T>
50
  bool operator>(const shared_ptr<T>& a, nullptr_t) noexcept;
51
  template <class T>
 
1
  ##### `shared_ptr` comparison <a id="util.smartptr.shared.cmp">[[util.smartptr.shared.cmp]]</a>
2
 
3
  ``` cpp
4
+ template<class T, class U>
5
+ bool operator==(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
6
  ```
7
 
8
  *Returns:* `a.get() == b.get()`.
9
 
10
  ``` cpp
11
+ template<class T, class U>
12
+ bool operator<(const shared_ptr<T>& a, const shared_ptr<U>& b) noexcept;
13
  ```
14
 
15
+ *Returns:* `less<>()(a.get(), b.get())`.
 
16
 
17
+ [*Note 9*: Defining a comparison function allows `shared_ptr` objects
18
+ to be used as keys in associative containers. — *end note*]
19
 
20
  ``` cpp
21
  template <class T>
22
  bool operator==(const shared_ptr<T>& a, nullptr_t) noexcept;
23
  template <class T>
 
41
  template <class T>
42
  bool operator<(nullptr_t, const shared_ptr<T>& a) noexcept;
43
  ```
44
 
45
  *Returns:* The first function template returns
46
+ `less<shared_ptr<T>::element_type*>()(a.get(), nullptr)`. The second
47
+ function template returns
48
+ `less<shared_ptr<T>::element_type*>()(nullptr, a.get())`.
49
 
50
  ``` cpp
51
  template <class T>
52
  bool operator>(const shared_ptr<T>& a, nullptr_t) noexcept;
53
  template <class T>