This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: istringstream.rdbuf with custom streambuf does not compile
- From: æå <ssawgift at 163 dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 6 May 2016 21:59:31 +0800
- Subject: Re: istringstream.rdbuf with custom streambuf does not compile
- Authentication-results: sourceware.org; auth=none
- References: <4c30a34b dot e913 dot 1548614fdb5 dot Coremail dot ssawgift at 163 dot com> <b1bd632 dot 10f324 dot 15486294330 dot Coremail dot lh_mouse at 126 dot com>
Sorry for my bad English. I meant 'intimidated' when I wrote 'intimated'.
As I understand how inheritance works for istringstream, I conclude that:
1. typedef basic_istringstream<char> istringstream;
2. basic_istringstream: public basic_istream: virtual public basic_ios
3.basic_io defines both rdbuf() const and
basic_streambuf<_CharT, _Traits>*
rdbuf(basic_streambuf<_CharT, _Traits>* __sb);
And, most importantly, both of rdbuf's are public methods.
So my understanding is that istringstream should have a public visible
rdbuf(streambuf*) method which the compiler should be able to resolve.
But, I am not quite confident about the above reasoning. Am I wrong or not?
å 2016/5/6 21:02, lh_mouse åé:
> The member function 'basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb)' of class template basic_ios is hidden *intentionally*.
>
> ISO/IEC WG21 (Working Draft, Standard for Programming Language C++) N4582:
> [quote]
> 27.8 String-based streams [string.streams]
> 27.8.3 Class template basic_istringstream [istringstream]
> namespace std {
> template <class charT, class traits = char_traits<charT>,
> class Allocator = allocator<charT> >
> class basic_istringstream : public basic_istream<charT,traits> {
> public:
> (... omitted ...)
> // 27.8.3.3 Members:
> basic_stringbuf<charT,traits,Allocator>* rdbuf() const;
> (... omitted ...)
> };
> [/quote]
>
> The function taking no parameters is the only overload required by the standard. It isn't a GCC bug.
>
> ------------------
> Best regards,
> lh_mouse
> 2016-05-06
>