title: -Wsign-conversion error when getting index for vector
body: <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  int main()
  {
      srand(time(NULL));
      std::vector&lt;std::string&gt; possible_result{&quot;Rock&quot;, &quot;Paper&quot;, &quot;Scissors&quot;};
      std::string selection{};
  
      std::cout &lt;&lt; &quot;(R)ock, (P)aper, (S)cissors: &quot;;
      while(std::cin &gt;&gt; selection){
          if (selection != &quot;R&quot; &amp;&amp; selection != &quot;P&quot; &amp;&amp; selection != &quot;S&quot;){
              std::cout &lt;&lt; &quot;I didn't get that, try again.\n&quot;;
          } else {
              std::string election = possible_result[rand() % 3];
              std::cout &lt;&lt; election &lt;&lt; '\n';
  
          }
          std::cout &lt;&lt; &quot;(R)ock, (P)aper, (S)cissors: &quot;;
      }
  
      return 0;
  }
  </code></pre>
  <p>I'm trying to do a simple Rock, Paper, Scissors game, however when trying to compile I get:</p>
  <p>&quot;error: conversion to ‘std::vectorstd::__cxx11::basic_string&lt;char &gt;::size_type’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Werror=sign-conversion]&quot;</p>
  <p>I'm using codeblocks, I have -Wsign-conversion in other compiler options, the program runs fine when I delete that line. I don't understand what the problem is, why does it compile without that line? How could I avoid getting that error?</p>