Commit 08522ad
committed
Simplify observer_ptr comparison
The comparison of _ptr is redundant as it can only be different if _auxiliary is different, and we don't care if it's the same unless _auxiliary is the same.
Annoyingly, the same simplification can't apply to the other comparison operators.
operator< will give a different order to other kinds of pointer comparison if it only cares about _auxiliary, and when comparing other kinds of pointer, we need to check that rhs isn't null before dereferencing it to get its auxiliary pointer, so still need three comparisons.
We could do a different three comparisons, but this is the easiest combination to read that works.1 parent 924d039 commit 08522ad
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
0 commit comments