|
num_get::getpublic member function
iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, bool& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, long& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, unsigned short& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, unsigned int& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, unsigned long& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, float& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, double& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, long double& val) const; iter_type get (iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, void*& val) const; Get numeric value Parses the sequence of characters between in and end for a numerical value, and stores it into v. For the process, it uses the formatting options selected in the object passed as io (using its ios_base::fmtflags value), and updates err with the error status if necessary.The extraction of the numerical value follows the same rules as scanf with the appropriate format specifier, extracting characters from the sequence until the character extracted cannot be part of a valid numerical expression or end is reached. The next character in the sequence is pointed by the iterator returned by the function. If the sequence of characters cannot produce a numerical value according to these rules and those specified by the numpunct facet of io's locale, the function sets err to ios_base::failbit. If the function exhausts the sequence of characters (i.e., it reaches end) during its operations, ios_base::eofbit is set in err (both failbit and eofbit may be set by an operation). Otherwise, ios_base::goodbit is set as err's value, indicating success. During its operation, the version of this function in the generic template simply calls the virtual protected member do_get, which is the member function in charge of performing the actions described above. Parameters
Return valueThe next character in the sequence right after where the extraction operation ended.iter_type is a member alias of the second template parameter of num_get (i.e., the facet's iterator type). Example
Possible output:
See also
|