Heapsort implementation in C++14
Answers:


Input iterator is not suitable for your plunge function. The reason
is in std::advance(). It increments the iterators, which
invalidates all previous ones. Bidirectional iterators are ok.
Use std::next() as mentioned in the comment by
user2296177.
No. Only random access iterators are mandated to support the
operation.


Here is the piece of C++ 14 standard that proves answer #1.

Paragraph 24.2.3 of N4296 (Input Iterators). Note from table 107 - Input Iterator requirements (in addition to Iterator). 

Expression:

++r;



  pre: r is dereferenceable.
  post: r is dereferenceable or
  r is past-the-end.
  post: any copies of the
  previous value of r are no
  longer required either to be
  dereferenceable or to be in
  the domain of ==.


where r is Input Iterator. Additionally, it is stated that post increment has the same effect. Either pre or post increment should be used to implement std::distance(), so it invalidates all copies of Input Iterators according to the standard.

Comments about the code

template&lt;
    class InputIt,
    class Key = std::less_equal&lt;
        std::iterator_traits&lt;InputIt&gt;::value_type
    &gt;
&gt;


Very arguable gain in readability.

Combo of first and last if preferred when referring to range. value is used to refer to some instance of T. ii and il make things even worse. Don't be lazy to type!

Bad idea to make iterators const. May be you wanted iterator pointing to const?

Nice usage of standard library (though you will need to be sure what it does, which you're trying to do). 

The code is not working for input iterators, as mentioned in answers.

Nice one for the first try overall.