| 371 | |
| 372 | public: |
| 373 | TItem* Insert(TItem* item) { |
| 374 | FixHeap(); |
| 375 | |
| 376 | if (Size >= MaxSize && item->Weight < GetLightest()->Weight) { |
| 377 | return item; |
| 378 | } |
| 379 | |
| 380 | Heap.push_back(item); |
| 381 | PushHeap(Heap.begin(), Heap.end(), THeapComparator()); |
| 382 | ++Size; |
| 383 | |
| 384 | return RemoveIfOverflown(); |
| 385 | } |
| 386 | |
| 387 | TItem* RemoveIfOverflown() { |
| 388 | if (Size <= MaxSize) { |
nothing calls this directly
no test coverage detected