Doc No: SC22/WG21/N2114 J16/06-0184 Date: 2006-10-17 Project: JTC1.22.32 Reply to: Robert Klarer IBM Canada, Ltd. klarer@ca.ibm.com
This paper proposes a small number of straightforward and probably
uncontroversial changes to the Working Draft to complete integration of
the long long
and unsigned long long
types with the C++ Standard Library.
This paper does not propose changes to the specification of the <random>
library because we already have a document that does so: N2079, "Random Number Generation in C++0X: A Comprehensive Proposal, version 3"
Among the changes proposed below is the addition of new virtual member functions (overloads of do_get
and do_put
) to the num_get
and num_put
facets. Normally, the introduction of virtual functions to an existing
class interface will pose backwards binary compatibility problems for
implementers and, ultimately, programmers. I believe, however, that
these virtual functions are already implemented widely as conforming
extensions, so I predict that no backwards incompatibility will result
from the changes.
This revision corrects embarrassing copy-and-paste typos in the original document, N2095.
add the following to "Header
template<> class numeric_limits<long long>; template<> class numeric_limits<unsigned long long>;
add the following to "Header <functional> synopsis":
template <> struct hash<long long>; template <> struct hash<unsigned long long>;
add the following to "Table 63: Header <cstdlib> synopsis":
strtoull
add the following public member functions to the class definition:
iter_type get(iter_type in, iter_type end, ios_base&, ios_base::iostate& err, long long& v) const; iter_type get(iter_type in, iter_type end, ios_base&, ios_base::iostate& err, unsigned long long& v) const;
add the following protected member functions to the class definition:
virtual iter_type do_get(iter_type in, iter_type end, ios_base&, ios_base::iostate& err, long long& v) const; virtual iter_type do_get(iter_type in, iter_type end, ios_base&, ios_base::iostate& err, unsigned long long& v) const;
add the following:
iter_type get(iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, long long& val) const; iter_type get(iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, unsigned long long& val) const;
to the list of function declarations before paragraph 1, add the following:
iter_type do_get(iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, long long& val) const; iter_type do_get(iter_type in, iter_type end, ios_base& str, ios_base::iostate& err, unsigned long long& val) const;
To "Table 70: Length Modifier," add the following rows:
long long
|
ll
|
unsigned long long
|
ll
|
add the following public member functions to the class definition:
iter_type put(iter_type s, ios_base& f, char_type fill, long long v) const; iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long long v) const;
add the following protected member functions to the class definition:
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long long v) const; virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long long v) const;
to the list of function declarations before paragraph 1, add the following:
iter_type put(iter_type out, ios_base& str, char_type fill, long long v) const; iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long v) const;
to the list of function declarations before paragraph 1, add the following:
iter_type do_put(iter_type out, ios_base& str, char_type fill, long long v) const; iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long v) const;
To "Table 73: Length Modifier," add the following rows:
long long
|
ll
|
unsigned long long
|
ll
|
These rows should appear above the row that reads "otherwise/none."
Add the following formatted input operators to the class synopsis:
// 27.6.1.2 Formatted input: ... basic_istream<charT, traits>& operator>>(long long& n); basic_istream<charT, traits>& operator>>(unsigned long long& n);
Add the following formatted input operators above paragraph 1:
operator>>(long long& val); operator>>(unsigned long long& val);
Add the following formatted input operators to the class synopsis:
// 27.6.2.5 Formatted output: ... basic_ostream<charT, traits>& operator<<(long long n); basic_ostream<charT, traits>& operator<<(unsigned long long n);
Add the following formatted output operators above paragraph 1:
operator<<(long long val); operator<<(unsigned long long val);
end of paper.