istringstream.rdbuf with custom streambuf does not compile

lh_mouse lh_mouse@126.com
Fri May 6 14:22:00 GMT 2016


> But, I am not quite confident about the above reasoning. Am I wrong or not?

ISO/IEC WG21 (Working Draft, Standard for Programming Language C++) N4582:
[quote]
10.2 Member name lookup [class.member.lookup]
4 If C contains a declaration of the name f, the declaration set contains every declaration of f declared in C
that satisfies the requirements of the language construct in which the lookup occurs. [ Note:  
(... omitted ...) —end note ] If the resulting declaration set is not empty, the subobject set contains C itself,
and calculation is complete.
[/quote]

The name lookup stops as soon as the compiler finds 'basic_stringbuf<charT,traits,Allocator>* rdbuf() const' of basic_istringstream.
This is commonly known as 'name hiding'. The name 'rdbuf' of ios_base is effectively hidden by that of basic_istringstream.

Your question is about C++ itself rather than GCC so I don't think they belong here. :>


------------------				 
Best regards,
lh_mouse
2016-05-06




More information about the Gcc-help mailing list