title: Is there a method/function in c++ which later constant parameters are based on the first ones?
body: <p>The constant parameter list seems to be error. I want to use the last parameter based on the 1st one    </p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;vector&gt;
  using namespace std;        
  
  template&lt;class T&gt;
  int ExistIndex(const vector&lt;T&gt; v, T obj, int start = 0, int end = v.size() - 1)
  {
      //The last parameter is the problem 
      //Finds the index where obj exists in the vector. If it does not 
      // -1 is returned. does not check for bounds
      for (int i = start; i &lt;= end; i++)
      {   
          //Finding the object
          if (v[i] == obj) return i;
      }
      return -1;
  }
  
  int main()
  {
        //Executing
        vector&lt;int&gt; v1 = {1, 2, 3, 4}
        int l = ExistIndex(v1, 3);// Although this compiles
  
        cout &lt;&lt; endl;
        system("pause");
        return 0;
  }
  </code></pre>