title: C++ overriding default less than argument for std::set for a particular data type
body: <p>I have lots of code which creates a <code>std::set&lt;Port*&gt;</code>. Now by default this uses <code>less&lt;Port*&gt;</code> which sorts the set on pointer values. This creates problem in our tool. I want to provide a default comparator <code>my_less</code> for all <code>set&lt;Port*&gt;</code> without having to go and change all the code. So I tried template specialization :</p>
  <pre><code>namespace std {
      template&lt;&gt; class set&lt;Port*&gt; : public set&lt;Port*, my_less&gt; {};
  };
  </code></pre>
  <p>I put this code in a header file already included by all the code files. This works the way I expected that all <code>set&lt;Port*&gt;</code> are now using <code>my_less</code>. The problem is that such specialization is not inheriting constructors. So i get an error if I want to do this :</p>
  <pre><code>std::set&lt;Port*&gt; myset_new(myset1.begin(), myset1.end());
  
  set.cpp:53:63: error: no matching function for call to
  ‘std::set&lt;Port*&gt;::set(std::set&lt;Port*, znl_id_less&gt;::iterator, std::set&lt;Port*, my_less&gt;::iterator)’
      set_include.h:27:70: note: candidates are: std::set&lt;Port*&gt;::set()
      set_include.h:27:70: note:                 std::set&lt;Port*&gt;::set(const std::set&lt;Port*&gt;&amp;)
  </code></pre>
  <p>What is a good way to solve this (I can copy the code for constructors but that doesn't seem clean).</p>
  <p>Is there any other way to achieve what I am trying to do apart from:</p>
  <pre><code>template&lt;&gt; class set&lt;Port*&gt; : public set&lt;Port*, my_less&gt; {};
  </code></pre>