From f7ab3fd1dcd2a9c75fc465c8585ebecfc1cb7acf Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 13 Oct 2006 22:46:58 +0000 Subject: [PATCH] istream.tcc (operator>>(__istream_type& (*)(__istream_type&)), operator>>(__ios_type& (*)(__ios_type&)), operator>>(ios_base& (*)(ios_base&))): Move... 2006-10-13 Paolo Carlini * include/bits/istream.tcc (operator>>(__istream_type& (*)(__istream_type&)), operator>>(__ios_type& (*)(__ios_type&)), operator>>(ios_base& (*)(ios_base&))): Move... * include/std/std_istream.h: ... here. (operator>>(basic_istream&, unsigned char&), operator>>(basic_istream&, signed char&), operator>>(basic_istream&, unsigned char*), operator>>(basic_istream&, signed char*)): Mark inline. * include/bits/ostream.tcc (operator<<(__ostream_type& (*)(__ostream_type&)), operator<<(__ios_type& (*)(__ios_type&)), operator<<(ios_base& (*)(ios_base&))): Move... * include/std/std_ostream.h: ... here. (operator<<(basic_ostream<>&, _CharT), operator<<(basic_ostream<>&, char), operator<<(basic_ostream&, char), operator<<(basic_ostream&, signed char), operator<<(basic_ostream&, unsigned char), operator<<(basic_ostream<>&, const _CharT*), operator<<(basic_ostream&, const char*), operator<<(basic_ostream&, const signed char*), operator<<(basic_ostream&, const unsigned char*), endl(basic_ostream<>&), ends(basic_ostream<>&), flush(basic_ostream<>&)): Mark inline. From-SVN: r117715 --- libstdc++-v3/ChangeLog | 26 +++++++++++ libstdc++-v3/include/bits/istream.tcc | 24 ---------- libstdc++-v3/include/bits/ostream.tcc | 35 -------------- libstdc++-v3/include/std/std_istream.h | 40 ++++++++++------ libstdc++-v3/include/std/std_ostream.h | 64 +++++++++++++++++--------- 5 files changed, 93 insertions(+), 96 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c42aba17c4f..9df16614528 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,29 @@ +2006-10-13 Paolo Carlini + + * include/bits/istream.tcc (operator>>(__istream_type& + (*)(__istream_type&)), operator>>(__ios_type& (*)(__ios_type&)), + operator>>(ios_base& (*)(ios_base&))): Move... + * include/std/std_istream.h: ... here. + (operator>>(basic_istream&, unsigned char&), + operator>>(basic_istream&, signed char&), + operator>>(basic_istream&, unsigned char*), + operator>>(basic_istream&, signed char*)): Mark inline. + * include/bits/ostream.tcc (operator<<(__ostream_type& + (*)(__ostream_type&)), operator<<(__ios_type& (*)(__ios_type&)), + operator<<(ios_base& (*)(ios_base&))): Move... + * include/std/std_ostream.h: ... here. + (operator<<(basic_ostream<>&, _CharT), + operator<<(basic_ostream<>&, char), + operator<<(basic_ostream&, char), + operator<<(basic_ostream&, signed char), + operator<<(basic_ostream&, unsigned char), + operator<<(basic_ostream<>&, const _CharT*), + operator<<(basic_ostream&, const char*), + operator<<(basic_ostream&, const signed char*), + operator<<(basic_ostream&, const unsigned char*), + endl(basic_ostream<>&), ends(basic_ostream<>&), + flush(basic_ostream<>&)): Mark inline. + 2006-10-13 Paolo Carlini PR libstdc++/28277 (partial: ostream bits 2) diff --git a/libstdc++-v3/include/bits/istream.tcc b/libstdc++-v3/include/bits/istream.tcc index dca39ec1424..39ee2c75772 100644 --- a/libstdc++-v3/include/bits/istream.tcc +++ b/libstdc++-v3/include/bits/istream.tcc @@ -85,30 +85,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } } - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - operator>>(__istream_type& (*__pf)(__istream_type&)) - { return __pf(*this); } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - operator>>(__ios_type& (*__pf)(__ios_type&)) - { - __pf(*this); - return *this; - } - - template - basic_istream<_CharT, _Traits>& - basic_istream<_CharT, _Traits>:: - operator>>(ios_base& (*__pf)(ios_base&)) - { - __pf(*this); - return *this; - } - template template basic_istream<_CharT, _Traits>& diff --git a/libstdc++-v3/include/bits/ostream.tcc b/libstdc++-v3/include/bits/ostream.tcc index a52eb4e3a00..5bfde44dd3a 100644 --- a/libstdc++-v3/include/bits/ostream.tcc +++ b/libstdc++-v3/include/bits/ostream.tcc @@ -61,41 +61,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __os.setstate(ios_base::failbit); } - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - operator<<(__ostream_type& (*__pf)(__ostream_type&)) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // The inserters for manipulators are *not* formatted output functions. - return __pf(*this); - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - operator<<(__ios_type& (*__pf)(__ios_type&)) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // The inserters for manipulators are *not* formatted output functions. - __pf(*this); - return *this; - } - - template - basic_ostream<_CharT, _Traits>& - basic_ostream<_CharT, _Traits>:: - operator<<(ios_base& (*__pf)(ios_base&)) - { - // _GLIBCXX_RESOLVE_LIB_DEFECTS - // DR 60. What is a formatted input function? - // The inserters for manipulators are *not* formatted output functions. - __pf(*this); - return *this; - } - template template basic_ostream<_CharT, _Traits>& diff --git a/libstdc++-v3/include/std/std_istream.h b/libstdc++-v3/include/std/std_istream.h index 862793e9ffe..e81c9cd9252 100644 --- a/libstdc++-v3/include/std/std_istream.h +++ b/libstdc++-v3/include/std/std_istream.h @@ -127,14 +127,23 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * functions in constructs like "std::cin >> std::ws". For more * information, see the iomanip header. */ - inline __istream_type& - operator>>(__istream_type& (*__pf)(__istream_type&)); + __istream_type& + operator>>(__istream_type& (*__pf)(__istream_type&)) + { return __pf(*this); } - inline __istream_type& - operator>>(__ios_type& (*__pf)(__ios_type&)); + __istream_type& + operator>>(__ios_type& (*__pf)(__ios_type&)) + { + __pf(*this); + return *this; + } - inline __istream_type& - operator>>(ios_base& (*__pf)(ios_base&)); + __istream_type& + operator>>(ios_base& (*__pf)(ios_base&)) + { + __pf(*this); + return *this; + } //@} // [27.6.1.2.2] arithmetic extractors @@ -247,7 +256,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @return The number of characters extracted by the previous * unformatted input function dispatched for this stream. */ - inline streamsize + streamsize gcount() const { return _M_gcount; } @@ -331,7 +340,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Returns @c get(s,n,widen('\n')). */ - inline __istream_type& + __istream_type& get(char_type* __s, streamsize __n) { return this->get(__s, __n, this->widen('\n')); } @@ -364,7 +373,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Returns @c get(sb,widen('\n')). */ - inline __istream_type& + __istream_type& get(__streambuf_type& __sb) { return this->get(__sb, this->widen('\n')); } @@ -404,7 +413,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * Returns @c getline(s,n,widen('\n')). */ - inline __istream_type& + __istream_type& getline(char_type* __s, streamsize __n) { return this->getline(__s, __n, this->widen('\n')); } @@ -675,7 +684,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * For ease of use, sentries may be converted to booleans. The * return value is that of the sentry state (true == okay). */ - operator bool() const { return _M_ok; } + operator bool() const + { return _M_ok; } private: bool _M_ok; @@ -699,12 +709,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c); template - basic_istream& + inline basic_istream& operator>>(basic_istream& __in, unsigned char& __c) { return (__in >> reinterpret_cast(__c)); } template - basic_istream& + inline basic_istream& operator>>(basic_istream& __in, signed char& __c) { return (__in >> reinterpret_cast(__c)); } //@} @@ -745,12 +755,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) operator>>(basic_istream& __in, char* __s); template - basic_istream& + inline basic_istream& operator>>(basic_istream& __in, unsigned char* __s) { return (__in >> reinterpret_cast(__s)); } template - basic_istream& + inline basic_istream& operator>>(basic_istream& __in, signed char* __s) { return (__in >> reinterpret_cast(__s)); } //@} diff --git a/libstdc++-v3/include/std/std_ostream.h b/libstdc++-v3/include/std/std_ostream.h index 6b4d389ac1f..5cac2c1760a 100644 --- a/libstdc++-v3/include/std/std_ostream.h +++ b/libstdc++-v3/include/std/std_ostream.h @@ -131,14 +131,34 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * functions in constructs like "std::cout << std::endl". For more * information, see the iomanip header. */ - inline __ostream_type& - operator<<(__ostream_type& (*__pf)(__ostream_type&)); - - inline __ostream_type& - operator<<(__ios_type& (*__pf)(__ios_type&)); - - inline __ostream_type& - operator<<(ios_base& (*__pf) (ios_base&)); + __ostream_type& + operator<<(__ostream_type& (*__pf)(__ostream_type&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + return __pf(*this); + } + + __ostream_type& + operator<<(__ios_type& (*__pf)(__ios_type&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + __pf(*this); + return *this; + } + + __ostream_type& + operator<<(ios_base& (*__pf) (ios_base&)) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 60. What is a formatted input function? + // The inserters for manipulators are *not* formatted output functions. + __pf(*this); + return *this; + } //@} // [27.6.2.5.2] arithmetic inserters @@ -405,7 +425,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) { // Data Members: bool _M_ok; - basic_ostream<_CharT,_Traits>& _M_os; + basic_ostream<_CharT, _Traits>& _M_os; public: /** @@ -420,7 +440,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * true ("okay"). */ explicit - sentry(basic_ostream<_CharT,_Traits>& __os); + sentry(basic_ostream<_CharT, _Traits>& __os); /** * @brief Possibly flushes the stream. @@ -469,29 +489,29 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * @c char, the character is widened before insertion. */ template - basic_ostream<_CharT, _Traits>& + inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) { return __out._M_insert(&__c, 1); } template - basic_ostream<_CharT, _Traits>& + inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) { return (__out << __out.widen(__c)); } // Specialization template - basic_ostream& + inline basic_ostream& operator<<(basic_ostream& __out, char __c) { return __out._M_insert(&__c, 1); } // Signed and unsigned template - basic_ostream& + inline basic_ostream& operator<<(basic_ostream& __out, signed char __c) { return (__out << static_cast(__c)); } template - basic_ostream& + inline basic_ostream& operator<<(basic_ostream& __out, unsigned char __c) { return (__out << static_cast(__c)); } //@} @@ -511,7 +531,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * determined by [22.2.2.2.2]). @c out.width(0) is then called. */ template - basic_ostream<_CharT, _Traits>& + inline basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) { if (!__s) @@ -527,7 +547,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Partial specializationss template - basic_ostream& + inline basic_ostream& operator<<(basic_ostream& __out, const char* __s) { if (!__s) @@ -539,12 +559,12 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Signed and unsigned template - basic_ostream& + inline basic_ostream& operator<<(basic_ostream& __out, const signed char* __s) { return (__out << reinterpret_cast(__s)); } template - basic_ostream & + inline basic_ostream & operator<<(basic_ostream& __out, const unsigned char* __s) { return (__out << reinterpret_cast(__s)); } //@} @@ -559,7 +579,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * on this subject. */ template - basic_ostream<_CharT, _Traits>& + inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { return flush(__os.put(__os.widen('\n'))); } @@ -570,7 +590,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * this correctly writes the ASCII @c NUL character string terminator. */ template - basic_ostream<_CharT, _Traits>& + inline basic_ostream<_CharT, _Traits>& ends(basic_ostream<_CharT, _Traits>& __os) { return __os.put(_CharT()); } @@ -580,7 +600,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * This manipulator simply calls the stream's @c flush() member function. */ template - basic_ostream<_CharT, _Traits>& + inline basic_ostream<_CharT, _Traits>& flush(basic_ostream<_CharT, _Traits>& __os) { return __os.flush(); } -- 2.30.2