virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, long& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, unsigned long& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, double& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, long double& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, void *& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, bool& val) const;
The first virtual protected member function endeavors to match sequential elements beginning at first
in the sequence
[first, last)
until it has recognized a complete, nonempty integer input field. If successful, it converts this field to
its equivalent value as type long, and stores the result in val
. It returns an iterator designating the first element beyond
the numeric input field. Otherwise, the function stores nothing in val
and sets ios_base::failbit
in st
. It returns an
iterator designating the first element beyond any prefix of a valid integer input field. In either case, if the return value
equals last
, the function sets ios_base::eofbit
in st
.
The integer input field is converted by the same rules used by the scan functions for matching and converting a series of
char elements from a file. (Each such char element is assumed to map to an equivalent element of type E
by a simple,
one-to-one, mapping.) The equivalent scan conversion specification is determined as follows:
x.
flags
() & ios_base::
basefield
== ios_base::
oct
, the conversion specification is lo
.x.flags() & ios_base::basefield == ios_base::
hex
, the conversion specification is lx
.x.flags() & ios_base::basefield == 0, the conversion specification is li
.ld
.The format of an integer input field is further determined by the locale facet fac
returned by the call use_facet
<
numpunct
<E>(x.
getloc
())
. Specifically:
fac.
grouping
()
determines how digits are grouped to the left of any decimal point.fac.
thousands_sep
()
determines the sequence that separates groups of digits to the left of any decimal point.If no instances of fac.thousands_sep()
occur in the numeric input field, no grouping constraint is imposed.
Otherwise, any grouping constraints imposed by fac.grouping()
is enforced and separators are removed before the
scan conversion occurs.
The second virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, unsigned long& val) const;
behaves the same as the first, except that it replaces a conversion specification of ld
with lu
. If successful it converts
the numeric input field to a value of type unsigned long and stores that value in val
.
The third virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, double& val) const;
behaves the same as the first, except that it endeavors to match a complete, nonempty floating-point input field.
fac.
decimal_point
()
determines the sequence that separates the integer digits from the fraction digits. The
equivalent scan conversion specifier is lf
.
The fourth virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, long double& val) const;
behaves the same as the third, except that the equivalent scan conversion specifier is Lf
.
The fifth virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, void *& val) const;
behaves the same as the first, except that the equivalent scan conversion specifier is p
.
The sixth virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last, ios_base& x,
ios_base::iostate& st, bool& val) const;
behaves the same as the first, except that it endeavors to match a complete, nonempty Boolean input field. If
successful, it converts the Boolean input field to a value of type bool
and stores that value in val
.
A Boolean input field takes one of two forms. If x.flags() & ios_base::
boolalpha
is false, it is the same as an
integer input field, except that the converted value must be either 0 (for false) or 1 (for true). Otherwise, the sequence
must match either fac.
falsename
()
(for false), or fac.
truename
()
(for true).