diff options
author | Nicolas Catania <niko@google.com> | 2010-02-04 12:15:36 -0800 |
---|---|---|
committer | Nicolas Catania <niko@google.com> | 2010-02-04 12:36:32 -0800 |
commit | 328cfeefa59a829fd8ae83ff1955c530a25b43ff (patch) | |
tree | 6a0466a6cff0755d987d3a8f9e221e5e90e2b2f2 /include | |
parent | 44d38f3d1ae0fd02030e259c4f93a265f91e96fc (diff) | |
download | astl-328cfeefa59a829fd8ae83ff1955c530a25b43ff.tar.gz |
iostream support for unsigned ints,float,double,bool
In <limits> added support for unsigned long and unsigned long long.
Diffstat (limited to 'include')
-rw-r--r-- | include/limits | 32 | ||||
-rw-r--r-- | include/ostream | 16 |
2 files changed, 46 insertions, 2 deletions
diff --git a/include/limits b/include/limits index 6f6d9f3..5213a65 100644 --- a/include/limits +++ b/include/limits @@ -182,6 +182,22 @@ struct numeric_limits<long> static const int digits10 = digits10<int, digits, is_signed>::value; }; +// numeric_limits<unsigned long> +template<> +struct numeric_limits<unsigned long> +{ + static const bool is_specialized = true; + + static unsigned long min() { return 0; } + static unsigned long max() { return ULONG_MAX; } + + static const bool is_signed = true; + static const bool is_integer = true; + + static const int digits = LONG_BIT; + static const int digits10 = digits10<int, digits, is_signed>::value; +}; + // numeric_limits<long long> template<> struct numeric_limits<long long> @@ -198,6 +214,22 @@ struct numeric_limits<long long> static const int digits10 = digits10<int, digits, is_signed>::value; }; +// numeric_limits<unsigned long long> +template<> +struct numeric_limits<unsigned long long> +{ + static const bool is_specialized = true; + + static unsigned long long min() { return 0; } + static unsigned long long max() { return ULLONG_MAX; } + + static const bool is_signed = true; + static const bool is_integer = true; + + static const int digits = static_cast<int>(sizeof(unsigned long long) * CHAR_BIT); + static const int digits10 = digits10<int, digits, is_signed>::value; +}; + } // namespace std diff --git a/include/ostream b/include/ostream index f7f2734..dc0b8e0 100644 --- a/include/ostream +++ b/include/ostream @@ -73,9 +73,21 @@ class ostream: public basic_ios return *this; } - ostream& operator<<(const char_type *str); - ostream& operator<<(int val); + ostream& operator<<(unsigned long int val); + ostream& operator<<(long int val); ostream& operator<<(unsigned int val); + ostream& operator<<(int val); + ostream& operator<<(unsigned long long int val); + ostream& operator<<(long long int val); + + ostream& operator<<(double val); + ostream& operator<<(float val); + + ostream& operator<<(char_type c); + ostream& operator<<(const char_type *str); + ostream& operator<<(bool val); + + // '(nil)' if p == 0 ostream& operator<<(const void *p); // This is non standard, used by string. |