diff options
Diffstat (limited to 'libstdc++-v3/include/bits')
-rw-r--r-- | libstdc++-v3/include/bits/ostream.tcc | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index cd9585073ae..e26ad50d6b8 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -122,6 +122,122 @@ namespace std template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: + operator<<(short __n) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + long __l; + const ios_base::fmtflags __fmt = (this->flags() + & ios_base::basefield); + if (__fmt == ios_base::oct || __fmt == ios_base::hex) + __l = static_cast<long>(static_cast<unsigned short>(__n)); + else + __l = static_cast<long>(__n); + const __num_put_type& __np = __check_facet(this->_M_num_put); + if (__np.put(*this, *this, this->fill(), __l).failed()) + __err |= ios_base::badbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<typename _CharT, typename _Traits> + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + operator<<(unsigned short __n) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + const __num_put_type& __np = __check_facet(this->_M_num_put); + if (__np.put(*this, *this, this->fill(), + static_cast<unsigned long>(__n)).failed()) + __err |= ios_base::badbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<typename _CharT, typename _Traits> + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + operator<<(int __n) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + long __l; + const ios_base::fmtflags __fmt = (this->flags() + & ios_base::basefield); + if (__fmt == ios_base::oct || __fmt == ios_base::hex) + __l = static_cast<long>(static_cast<unsigned int>(__n)); + else + __l = static_cast<long>(__n); + const __num_put_type& __np = __check_facet(this->_M_num_put); + if (__np.put(*this, *this, this->fill(), __l).failed()) + __err |= ios_base::badbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<typename _CharT, typename _Traits> + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: + operator<<(unsigned int __n) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + const __num_put_type& __np = __check_facet(this->_M_num_put); + if (__np.put(*this, *this, this->fill(), + static_cast<unsigned long>(__n)).failed()) + __err |= ios_base::badbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<typename _CharT, typename _Traits> + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: operator<<(long __n) { sentry __cerb(*this); @@ -216,6 +332,32 @@ namespace std template<typename _CharT, typename _Traits> basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>:: + operator<<(float __n) + { + sentry __cerb(*this); + if (__cerb) + { + ios_base::iostate __err = ios_base::iostate(ios_base::goodbit); + try + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 117. basic_ostream uses nonexistent num_put member functions. + const __num_put_type& __np = __check_facet(this->_M_num_put); + if (__np.put(*this, *this, this->fill(), + static_cast<double>(__n)).failed()) + __err |= ios_base::badbit; + } + catch(...) + { this->_M_setstate(ios_base::badbit); } + if (__err) + this->setstate(__err); + } + return *this; + } + + template<typename _CharT, typename _Traits> + basic_ostream<_CharT, _Traits>& + basic_ostream<_CharT, _Traits>:: operator<<(double __n) { sentry __cerb(*this); |