title: C++ vector of priority_queue of strings with custom strings comparator
body: <p>I have a <code>vector</code> of <code>priority_queue</code>s of <code>string</code>s:</p>
  
  <pre><code>vector&lt;priority_queue&lt;string&gt;&gt;&gt; queues(VECTOR_CAPACITY);
  </code></pre>
  
  <p>And the question is how can I apply custom <code>string</code> comparator to those <code>priority_queue</code>s?</p>
  
  <p>Should this be relevant, the comparator I want puts shorter strings before longer ones and when they're equal length uses standard strings comparison.</p>
  
  <p>I tried this way:</p>
  
  <pre><code>auto comparator = [] (string s1, string s2) { return s1.length() &lt; s2.length() || s1 &lt; s2; };
  vector&lt;priority_queue&lt;string, vector&lt;string&gt;, decltype(comparator)&gt;&gt; queues(VECTOR_CAPACITY);
  </code></pre>
  
  <p>but it doesn't compile with the following error:</p>
  
  <blockquote>
  <pre><code>No matching constructor for initialization of 'value_compare' (aka
  '(lambda at Example.cpp:202:23)')
  </code></pre>
  </blockquote>
  
  <hr>
  
  <p>EDIT:
  Comparator that puts shorter strings before longer ones and when they're equal length uses standard lexicographic comparison looks like that:</p>
  
  <pre><code>auto comparator = [] (string s1, string s2)
  {
      if (s1.length() != s2.length())
      {
          return s1.length() &gt; s2.length();
      }
      return s1.compare(s2) &gt; 0;
  };
  </code></pre>