title: Why does std::stof not throw when passed an argument it cannot convert?
body: <p>I'm working on a project where I want to accept an input of the form <code>{float}{single-letter-identifier}</code>, for example <code>15.6E</code>, or <code>10W</code>.</p>
  
  <p>To do this, I thought that I could take the input string, strip off the last letter and then check to see if a conversion could be performed to float, using <code>std::stof</code>. This would be nested in a <code>try-catch</code> block, and allow me to notify the user of invalid input.</p>
  
  <p>The open-standard of the STL <a href="http://open-std.org/JTC1/SC22/WG21/docs/papers/2010/n3126.pdf" rel="noreferrer">here</a> (page 653) states that <code>std::stof</code> throws:</p>
  
  <blockquote>
    <p><code>invalid_argument</code> if wcstod or wcstold reports that no conversion could be performed.</p>
  </blockquote>
  
  <p>However, it doesn't throw when passed something it cannot convert, e.g. <code>"48East"</code>. A code sample to reproduce this behavior is below:</p>
  
  <pre><code>std::wstring szString = L"48East";
  try{
       float f = std::stof(szString);
  } catch( ... )
  {
       std::cout &lt;&lt; "test" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>This is compiled on MSVC10 in debug mode with <code>/Od</code>, so I'm assuming the call is not optimized away.</p>
  
  <p>I'd appreciate any help (or guidance as to where I've misunderstood/misread the spec!).</p>