title: convert string to size_t
body: <p>Is there a way to convert <code>std::string</code> to <code>size_t</code>?
  The problem is that <code>size_t</code> is platform dependable type (while it is the result of the <code>sizeof</code>). So, I can not guarantee that converting <code>string</code> to <code>unsigned long</code> or <code>unsigned int</code> will do it correctly.</p>
  
  <p>EDIT:
  A simple case is:</p>
  
  <pre><code>std::cout&lt;&lt; "Enter the index:";
  std::string input;
  std::cin &gt;&gt; input;
  size_t index=string_to_size_t(input);
  //Work with index to do something
  </code></pre>