title: C++ Clean String to int cast
body: <p>As far as i know, the common way in c++ to cast a String into a int is to use sstream:</p>
  
  <pre><code>   std::string inputString = "12 34";
     std::istringstream istr(inputString);
     int i1, i2;
     istr &gt;&gt; i1 &gt;&gt; i2;
  </code></pre>
  
  <p>But if I want to make sure, that my code works for any input, the problem is to decide between the input of a string or 0:</p>
  
  <pre><code>   std::string inputString = "TEXT 0";
     std::istringstream istr(inputString);
     int i1, i2;
     istr &gt;&gt; i1 &gt;&gt; i2;
     cout &lt;&lt; i1 &lt;&lt;"  !=  "&lt;&lt; i2 &lt;&lt; endl;
  </code></pre>
  
  <p>I want to decide, if the user has inputed a String or a zero, in order to perform further manipulation.
  Is there a <strong>clean</strong> way to decide this problem, without using lexical cast or atoi?
  best gegards</p>