title: checking data availability before calling std::getline
body: <p>I would like to read some data from a stream I have using <code>std::getline</code>.
  Below a sample using the <code>std::cin</code>.</p>
  
  <pre><code>std::string line;
  std::getline( std::cin, line );
  </code></pre>
  
  <p>This is a blocking function i.e. if there is no data or line to read it blocks execution.</p>
  
  <p>Do you know if exists a function for checking data availability before calling <code>std::getline</code>? I don't want to block. </p>
  
  <p>How can I check whether the stream buffer is full of data valid for a successful call to <code>std::getline</code>?</p>
  
  <p>Whatever looks like the code below</p>
  
  <pre><code>if( dataAvailableInStream() )
  {
       std::string line;
       std::getline( std::cin, line );
  }
  </code></pre>