title: Multiple Operator() Overloading in same Class
body: <p>I'm having a problem sorting two data structures in one class. One data structure is an array of vectors. I'm successfully using the std::sort routine on this data structure. To do this, I am overloading operator().</p>
  
  <p>I want to use a priority queue on another data member and member function of the same class. However, to do that I have been trying to overload operator(), but get an error message from my compiler (g++ in the Orwell Fork version of Dev-C++) stating that I cannot overload operator() again. I can understand the logic behind this.</p>
  
  <p>So, my question is: can I use both the std::sort routine and a priority queue used to sort data in the same class?</p>
  
  <p>Thank you.</p>
  
  <p>Edit for additional information:</p>
  
  <p>I have two classes, a computer class and a PCB class.</p>
  
  <p>In the PCB class is a function called "getTau," and a function called "getDiskTime." I want to sort my output in one area by obtaining the least to greatest getTau value. In the other area, I want to sort my output by least to greatest getDiskTime value. I'm building an operating system simulation, and these are processes I'm sorting and outputting basically. This is the code I am using successfully at this point:</p>
  
  <pre><code>#include &lt;algorithm&gt;...
  
  class computer
  {
      ...
      vector&lt;PCB&gt; readyQueue[9];
      ...
      bool operator() ( PCB p1, PCB p2 )
  {
      return p1.getTau() &lt; p2.getTau();
  }
      ...
  } t ;
  </code></pre>
  
  <p>And in another member function of class computer, I am calling the sort function:</p>
  
  <pre><code>std::sort ( readyQueue.begin(), readyQueue.end(), t );
  </code></pre>
  
  <p>And everything is working well.</p>
  
  <p>As you might imagine I have a PCB class with a data member called tau which getTau returns. In that same PCB class I have a data member named diskTime which getDiskTime returns. I am trying to sort that in a disk queue I have in the computer class.</p>
  
  <p>I have tried many things such as placing this in the PCB class:</p>
  
  <pre><code>bool operator &lt; ( PCB &amp; p1)
  {
  return p1.getDiskTime() &lt; this-&gt;getDiskTime();
  
  }
  </code></pre>
  
  <p>But when I return the value of diskTime is a few outputs of that queue, diskTime is not sorted by lowest value first.</p>
  
  <p>I can give more information if that will help. Thank you.</p>