Commit 1dc5c43
committed
Fix queue/stack friendship.
queue<T, NonSpaceshipContainer> might be instantiated for a
non-three_way_comparable NonSpaceshipContainer. In that case, it
shouldn't attempt to grant friendship to the spaceship operator,
because that would attempt to form
compare_three_way_result_t<NonSpaceshipContainer>.
As far as I can tell, there's no way in the Core Language for a queue
to grant friendship to only one specialization of its non-member
spaceship operator while respecting the constraint. (See
WG21-N4861 [temp.friend]/9.) Instead, we need to template the
friendship declaration, such that queue grants friendship to all of its
spaceship operators. This is safe, just verbose.1 parent f6c5510 commit 1dc5c43
2 files changed
+10
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
160 | | - | |
161 | | - | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
162 | 164 | | |
163 | 165 | | |
164 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
152 | 154 | | |
153 | 155 | | |
154 | 156 | | |
| |||
0 commit comments