Приоритетная очередь наоборот
Ах да, как же я не догадался, всё же так логично. Как говорил Торвальдс, "Standards are paper. I use paper to wipe my butt every day. That's how much that paper is worth." Compare - A Compare type providing a strict weak ordering. Note that the Compare parameter is defined such that it returns true if its first argument comes before its second argument in a weak ordering. But because the priority queue outputs largest elements first, the elements that "come before" are actually output last. That is, the front of the queue contains the "last" element according to the weak ordering imposed by Compare.
На изображении цитата Линуса Торвальдса о стандартах наложена на документацию C++ к типу Compare и priority queue. Шутка в том, что логика приоритетной очереди кажется перевёрнутой: элементы, которые считаются меньшими и идут «раньше» в слабом порядке, фактически выводятся последними. EN: The image shows a quote attributed to Linus Torvalds about standards overlaid on C++ documentation for Compare and priority_queue. The joke is that the priority queue’s logic seems backwards: elements considered smaller and coming “before” in the weak ordering are actually output last.
documentation screenshot / скриншот документацииpriority queue / приоритетная очередьprogramming code reference / справочник по программированиюtext block / текстовый блокdark background / тёмный фонwhite rounded panel / белая панель с закруглёнными угламиquote / цитатаcomputer science concept / концепция информатикиordering definition / определение порядкаtechnical explanation / техническое объяснение
- @right_wing_dev_squads / 8763 2024-02-19
- Type
- image
- Size
- 614×251 · 34.6 KiB
- Mood
- саркастичный, абсурдный
- Language
- ru
- Added