public member function
<regex>
Test whether results are ready
Return value
true if the object has a fully established result state. false otherwise.
Example
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 
 | // match_results::ready
// - using smatch, a standard alias of match_results<string::iterator>
#include <iostream>
#include <string>
#include <regex>
int main ()
{
  std::string mystring ("subject");
  std::smatch mymatch;
  std::regex myregex ("sub.*");
  std::cout << std::boolalpha;
  std::cout << "mymatch.ready() is " << mymatch.ready() << std::endl;
  std::regex_match ( mystring, mymatch, myregex );
  std::cout << "attempting match..." << std::endl;
  
  std::cout << "mymatch.ready() is " << mymatch.ready() << std::endl;
  if (mymatch.ready()) std::cout << "matched: " << mymatch[0] << std::endl;
  return 0;
}
 | 
Output:
| mymatch.ready() is false
attempting match...
mymatch.ready() is true
matched: subject
 |