title: C++ Function returns int to string variable
body: <p>I have a function that generates a random number. The problem is that I use it in a template class where T may be int or string. When I choose string I get an error about impossible conversion. How can I return an integer and assign it to a string depending on the template type?</p>
  
  <pre><code>CTable(){
      for (int i = 0; i &lt; 10; i++){
          int row = GenerateNumber();
          int col = GenerateNumber();
          T value = GenerateNumber(); //problem here when T is string
          CCellDescr c(row, col, value);
          cells.push_back(c);
      }
  }
  
  int GenerateNumber(){
      int number = rand() % 10 + 1;
      return number;
  }
  </code></pre>