MESSAGE
DATE | 2011-07-07 |
FROM | Ruben Safir
|
SUBJECT | Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
|
-- forwarded message -- Path: reader1.panix.com!panix!not-for-mail From: Ruben Safir Newsgroups: comp.lang.c++ Subject: Re: iostream manipulator construction and design Date: Thu, 7 Jul 2011 02:51:43 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 27 Message-ID: References: NNTP-Posting-Host: www2.mrbrklyn.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reader1.panix.com 1310007103 19740 96.57.23.82 (7 Jul 2011 02:51:43 GMT) X-Complaints-To: abuse-at-panix.com NNTP-Posting-Date: Thu, 7 Jul 2011 02:51:43 +0000 (UTC) User-Agent: Pan/0.133 (House of Butterflies) Xref: panix comp.lang.c++:1087358
On Wed, 06 Jul 2011 19:13:22 +0200, Alf P. Steinbach /Usenet wrote:
> std::ostream& operator<<( > std::ostream& stream, > MyWidthManip const& m > ) > { > stream.setw( m.w_ ); // I'm just assuming there is a setw. > Dunno. return stream; > } > > And that's it. > > For a manipulator without arguments you don't need a supporting class, > because the manipulator can just be a function that << operator then > calls.
what is wrong with
std::ostream& operator<<(std::ostread& os, flags (*f)(int a)) { os.setf(f(a)); }
flags setw(x){ return std::ios_base:setw(x); } -- end of forwarded message --
|
|