Re: VS: operator <<(...const std::string&) does not call ->rdbuf()
- From: Victor Bazarov <v.Abazarov@xxxxxxxxxxxx>
- Date: Tue, 17 Nov 2009 12:58:47 -0500
Paul wrote:
"Victor Bazarov" wrote:
Paul wrote:As I understand from the C++ Standard, operatorI don't see the Standard saying that it "should". I see "inserts characters as if by calling os.rdbuf()->sputn", nothing about "should" or "shall" or some other requirement.
std::ostream& operator <<(std::ostream& os, const std::string& s);
should call os.rdbuf()->sputn()
But to me this is as good as saying that the effect should be as if "os.rdbuf()->sputn(str.data(), n)" is called and not ->sputc().
[..]
Maybe there is a defect in the Standard, or a defect in Dinkumware's implementation (based on their interpretation). What would be the [observable] difference between calling 'sputn' and 'sputc' (repeatedly)? I'm guessing you need your virtual function called (as specified in the behaviour of 'sputn')
If you think it's a defect in the implementation, contact Dinkumware or Microsoft and see what they have to say about that. If you think it's a defect in the Standard (and the expected wording needs to be stronger), post to 'comp.std.c++'.
Is there a different approach available to you? 'sputc' is specified to check the availability of the room in the buffer using the pointers (xnext and xend), and call 'overflow' where you're supposed to dump the characters (send or whatever), and change the pointers (not sure what the right code is). What book are you reading, BTW? I remember hearing that Angelika Langer's "Standard C++ Iostreams" was very good. Also, Josuttis' C++ Standard Library book is highly praised.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
- Follow-Ups:
- References:
- Prev by Date: Re: using the string class with LoadString( )
- Next by Date: Code size "profiling"
- Previous by thread: Re: VS: operator <<(...const std::string&) does not call ->rdbuf()
- Next by thread: Re: VS: operator <<(...const std::string&) does not call ->rdbuf()
- Index(es):
Relevant Pages
|