# money_get::do_get

**Visual Studio 2008**

Virtual function called to extracts a numerical value from a character sequence that represents a monetary value.

virtual iter_type do_get( iter_type _First, iter_type _Last, bool _Intl, ios_base& _Iosbase, ios_base::iostate& _State, long double& _Val ) const virtual iter_type do_get( iter_type _First, iter_type _Last, bool _Intl, ios_base& _Iosbase, ios_base::iostate& _State, string_type& _Val ) const

The first virtual protected member function tries to match sequential elements beginning at first in the sequence [_First, _Last) until it has recognized a complete, nonempty monetary input field. If successful, it converts this field to a sequence of one or more decimal digits, optionally preceded by a minus sign (–), to represent the amount and stores the result in the string_type object _Val. It returns an iterator designating the first element beyond the monetary input field. Otherwise, the function stores an empty sequence in _Val and sets **ios_base::failbit** in _State. It returns an iterator designating the first element beyond any prefix of a valid monetary input field. In either case, if the return value equals _Last, the function sets **ios_base::eofbit** in _State.

The second virtual protected member function behaves the same as the first, except that if successful it converts the optionally signed digit sequence to a value of type long double and stores that value in _Val.

The format of a monetary input field is determined by the locale facet **fac** returned by the effective call use_facet <moneypunct<**CharType**, **intl**>>(**iosbase**.getloc).

Specifically:

**fac**.neg_format determines the order in which components of the field occur.**fac**.curr_symbol determines the sequence of elements that constitutes a currency symbol.**fac**.positive_sign determines the sequence of elements that constitutes a positive sign.**fac**.negative_sign determines the sequence of elements that constitutes a negative sign.**fac**.grouping determines how digits are grouped to the left of any decimal point.**fac**.thousands_sep determines the element that separates groups of digits to the left of any decimal point.**fac**.decimal_point determines the element that separates the integer digits from the fraction digits.**fac**.frac_digits determines the number of significant fraction digits to the right of any decimal point. When parsing a monetary amount with more fraction digits than are called for by**frac_digits**,**do_get**stops parsing after consuming at most**frac_digits**characters.

If the sign string (**fac**.**negative_sign** or **fac**.**positive_sign**) has more than one element, only the first element is matched where the element equal to **money_base::sign** appears in the format pattern (**fac**.**neg_format**). Any remaining elements are matched at the end of the monetary input field. If neither string has a first element that matches the next element in the monetary input field, the sign string is taken as empty and the sign is positive.

If **iosbase**.flags &showbase is nonzero, the string **fac**.**curr_symbol** must match where the element equal to **money_base::symbol** appears in the format pattern. Otherwise, if **money_base::symbol** occurs at the end of the format pattern, and if no elements of the sign string remain to be matched, the currency symbol is not matched. Otherwise, the currency symbol is optionally matched.

If no instances of **fac**.**thousands_sep** occur in the value portion of the monetary input field (where the element equal to **money_base::value** appears in the format pattern), no grouping constraint is imposed. Otherwise, any grouping constraints imposed by **fac**.**grouping** is enforced. Note that the resulting digit sequence represents an integer whose low-order **fac**.**frac_digits** decimal digits are considered to the right of the decimal point.

Arbitrary white space is matched where the element equal to **money_base::space** appears in the format pattern, if it appears other than at the end of the format pattern. Otherwise, no internal white space is matched. An element *ch* is considered white space if use_facet <ctype<**CharType**> >(**iosbase**.getloc).is(**ctype_base::space**, *ch*) is **true**.