title: (C++) error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
body: <p>I'm trying to write a function that would return a substring from the given start and end indices. This is the code that I've written but when i run it it gives me error. I'm using gtest to run it not main().</p>
  <pre><code>template &lt;typename S&gt;
  S substring(S string_, int Istart, int Iend)
  {
      S substr = string_[Istart];
      for(int i=(Istart+1); i&lt;Iend; i++)
      {
          substr += string_[i];
      }
      return substr;    
  }
  </code></pre>
  <p><strong>And this is the error i get:</strong></p>
  <pre><code>In file included from test.cpp:2:0:
  lab2.cpp: In instantiation of ‘S substring(S, int, int) [with S = const char*]’:
  test.cpp:56:1:   required from here
  lab2.cpp:91:23: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
       S substr = string_[Istart];
                  ~~~~~~~^
  </code></pre>
  <p>My test code is this:</p>
  <pre><code>TEST(subStr, T1){
  string str=&quot;he&quot;;
  EXPECT_EQ(str,substring(&quot;hello&quot;, 0, 2));
  }
  TEST(subStr, T2){
  string str=&quot;urge&quot;;
  EXPECT_EQ(str,substring(&quot;hamburger&quot;, 4, 8));
  }
  </code></pre>