title: Why does comparison function type need to specified as template parameter?
body: <p>For associative containers in C++, like set, map etc, we need to provide the custom key comparator type as a template parameter as follows.</p>
  
  <pre><code>bool compareMyType(const MyType&amp; a, const MyType&amp; b);
  
  set&lt;MyType, decltype(compareMyType)*&gt; my_set(compareMyType); // OK
  set&lt;MyType&gt; my_set(compareMyType); // ERROR
  </code></pre>
  
  <p>Why is this required? Why can't the type of comparator function be deduced by the type of key?</p>