MESSAGE
DATE | 2011-06-05 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: basic_ostream question
|
-- forwarded message -- Path: reader1.panix.com!panix!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!16g2000yqy.googlegroups.com!not-for-mail From: Michael Doubez Newsgroups: comp.lang.c++ Subject: Re: basic_ostream question Date: Fri, 3 Jun 2011 02:56:45 -0700 (PDT) Organization: http://groups.google.com Lines: 26 Message-ID: References: NNTP-Posting-Host: 62.160.54.163 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1307095005 23811 127.0.0.1 (3 Jun 2011 09:56:45 GMT) X-Complaints-To: groups-abuse-at-google.com NNTP-Posting-Date: Fri, 3 Jun 2011 09:56:45 +0000 (UTC) Complaints-To: groups-abuse-at-google.com Injection-Info: 16g2000yqy.googlegroups.com; posting-host=62.160.54.163; posting-account=4_dwSAoAAAD_OEYz89wEMQOvnJlm6isC User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESRCNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1,gzip(gfe) Xref: panix comp.lang.c++:1085962
On 3 juin, 04:44, ruben safir wrote: > On 06/01/2011 12:50 AM, red floyd wrote: > > > ((std::cout.operator<<("x= ")).operator<<(x)).operator<<(std::endl); > > well for one thing, this one I didn't expect to get hex code.
Because, the only ioperator available is: basic_ostream& operator<<(const void* p);
Which writes the pointer value (like %#p in printf).
The string version is the free function:
template basic_ostream& operator<<(basic_ostream& out, const char* s); // ... other templates cf. 27.6.2.5.4 of the standard
Which computes the length and inserts the string into the stream. AFAIK there are no corresponding function in the std::ostream interface (for formated output).
-- Michael -- end of forwarded message --
|
|