title: How to return two values from a function in C++?
body: <p>How to return a integer and a vector from a function. In c++11 I can use tuple. But I have to use C++98 standard.</p>
  
  <p>problem is like this,</p>
  
  <pre><code>int myfunction(parameter 1,parameter 2)
  {
     vector&lt;int&gt; created_here;
     //do something with created here
     return int &amp; created_here both
  
  }
  </code></pre>
  
  <p>How can I do that. By the way, I have to use my function recursively.So
  I have thought a way like this,</p>
  
  <pre><code>int n;
  vector&lt;int&gt; A;
  int myfunction(int pos,int mask_cities,vector&lt;int&gt; &amp;A)
  {
      if(mask = (1&lt;&lt;n)-1)
          return 0;
      vector&lt;int&gt; created_here;
      int ans = 999999;
      for(int i=0;i&lt;n;++i){
         int tmp = myfunction(pos+1,mask|1&lt;&lt;i,created_here);
         if(tmp&lt;ans){
              A = created_here;
              ans = tmp;
         }
     } 
     return ans; 
  
  }
  </code></pre>
  
  <p>will this work? Or there is a better solution.
  and By the way, My actual problem is finding the solution of the travelling salesman problem.that should clarify my needs</p>