Skip to main content
Code Review

Return to Revisions

2 of 2
Commonmark migration

L. F. gave a good review, but there is more:

  1. Exceptions are not for programmer errors. That's what asserts are for.

  2. Modularise your code:

    Extract down_heap() and up_heap() as free functions, making the algorithm available for anyone wanting to manipulate a heap.
    They should accept an iterator-range and a comparator, with the default being std::less<>().

  3. Mark things noexcept if you can. Consider conditional noexcept too.

  4. Also, make them constexpr if applicable.

Deduplicator
  • 19.6k
  • 1
  • 32
  • 65
default

AltStyle によって変換されたページ (->オリジナル) /