The function extracts characters until the character extracted cannot be part of a valid monetary sequence expression or end is reached. The next character in the sequence is pointed by the iterator returned by the function.
What constitutes a valid monetary sequence depends on the locale (according to moneypunct<charT,intl>, where intl is the third parameter of this function).
If successful, the first version stores a floating-point value with the interpretation of the monetary expression in units. The second stores in digits a string object with the digits extracted (only the digits, no punctuation marks).
The function updates err with the error status if necessary:
If the sequence of characters cannot produce any valid value as result according to its formatting rules, 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 a single 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 implementeing the behavior described above.
- s, end
- Iterators pointing to the beginning and ending characters of the sequence. The range used is [s,end), which contains all the characters between s and end, including the character pointed by s but not the character pointed by end.
iter_type is a member alias of the second template parameter of num_get (i.e., the facet's iterator type). This can be any input iterator. By default, this is an istreambuf_iterator, allowing implicit conversions from istream objects.
- Value to be used as the international representation template argument for the corresponding moneypunct class template.
- Object of a class derived from ios_base (generally an input stream object). It is used to obtain formatting information.
- Stream error state object, of type ios_base::iostate where the resulting state will be stored.
- The function stores in this variable the floating point value equivalent to the monetary expression read.
- The function stores in this variable a string object with the digits successfully extracted (only the digits, no punctuation marks).
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 money_get (i.e., the facet's iterator type).
Please, enter the price: $12.95 ERROR: failed to read price
The default locale could not interpret the format of that price.
|money_put::put||Format monetary expression (public member function)|
|num_get||Facet to parse numeric values (class template)|