Mon Dec 11 14:11:18 2017
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2011-07-01

HANGOUT

2017-12-11 | 2017-11-11 | 2017-10-11 | 2017-09-11 | 2017-08-11 | 2017-07-11 | 2017-06-11 | 2017-05-11 | 2017-04-11 | 2017-03-11 | 2017-02-11 | 2017-01-11 | 2016-12-11 | 2016-11-11 | 2016-10-11 | 2016-09-11 | 2016-08-11 | 2016-07-11 | 2016-06-11 | 2016-05-11 | 2016-04-11 | 2016-03-11 | 2016-02-11 | 2016-01-11 | 2015-12-11 | 2015-11-11 | 2015-10-11 | 2015-09-11 | 2015-08-11 | 2015-07-11 | 2015-06-11 | 2015-05-11 | 2015-04-11 | 2015-03-11 | 2015-02-11 | 2015-01-11 | 2014-12-11 | 2014-11-11 | 2014-10-11 | 2014-09-11 | 2014-08-11 | 2014-07-11 | 2014-06-11 | 2014-05-11 | 2014-04-11 | 2014-03-11 | 2014-02-11 | 2014-01-11 | 2013-12-11 | 2013-11-11 | 2013-10-11 | 2013-09-11 | 2013-08-11 | 2013-07-11 | 2013-06-11 | 2013-05-11 | 2013-04-11 | 2013-03-11 | 2013-02-11 | 2013-01-11 | 2012-12-11 | 2012-11-11 | 2012-10-11 | 2012-09-11 | 2012-08-11 | 2012-07-11 | 2012-06-11 | 2012-05-11 | 2012-04-11 | 2012-03-11 | 2012-02-11 | 2012-01-11 | 2011-12-11 | 2011-11-11 | 2011-10-11 | 2011-09-11 | 2011-08-11 | 2011-07-11 | 2011-06-11 | 2011-05-11 | 2011-04-11 | 2011-03-11 | 2011-02-11 | 2011-01-11 | 2010-12-11 | 2010-11-11 | 2010-10-11 | 2010-09-11 | 2010-08-11 | 2010-07-11 | 2010-06-11 | 2010-05-11 | 2010-04-11 | 2010-03-11 | 2010-02-11 | 2010-01-11 | 2009-12-11 | 2009-11-11 | 2009-10-11 | 2009-09-11 | 2009-08-11 | 2009-07-11 | 2009-06-11 | 2009-05-11 | 2009-04-11 | 2009-03-11 | 2009-02-11 | 2009-01-11 | 2008-12-11 | 2008-11-11 | 2008-10-11 | 2008-09-11 | 2008-08-11 | 2008-07-11 | 2008-06-11 | 2008-05-11 | 2008-04-11 | 2008-03-11 | 2008-02-11 | 2008-01-11 | 2007-12-11 | 2007-11-11 | 2007-10-11 | 2007-09-11 | 2007-08-11 | 2007-07-11 | 2007-06-11 | 2007-05-11 | 2007-04-11 | 2007-03-11 | 2007-02-11 | 2007-01-11 | 2006-12-11 | 2006-11-11 | 2006-10-11 | 2006-09-11 | 2006-08-11 | 2006-07-11 | 2006-06-11 | 2006-05-11 | 2006-04-11 | 2006-03-11 | 2006-02-11 | 2006-01-11 | 2005-12-11 | 2005-11-11 | 2005-10-11 | 2005-09-11 | 2005-08-11 | 2005-07-11 | 2005-06-11 | 2005-05-11 | 2005-04-11 | 2005-03-11 | 2005-02-11 | 2005-01-11 | 2004-12-11 | 2004-11-11 | 2004-10-11 | 2004-09-11 | 2004-08-11 | 2004-07-11 | 2004-06-11 | 2004-05-11 | 2004-04-11 | 2004-03-11 | 2004-02-11 | 2004-01-11 | 2003-12-11 | 2003-11-11 | 2003-10-11 | 2003-09-11 | 2003-08-11 | 2003-07-11 | 2003-06-11 | 2003-05-11 | 2003-04-11 | 2003-03-11 | 2003-02-11 | 2003-01-11 | 2002-12-11 | 2002-11-11 | 2002-10-11 | 2002-09-11 | 2002-08-11 | 2002-07-11 | 2002-06-11 | 2002-05-11 | 2002-04-11 | 2002-03-11 | 2002-02-11 | 2002-01-11 | 2001-12-11 | 2001-11-11 | 2001-10-11 | 2001-09-11 | 2001-08-11 | 2001-07-11 | 2001-06-11 | 2001-05-11 | 2001-04-11 | 2001-03-11 | 2001-02-11 | 2001-01-11 | 2000-12-11 | 2000-11-11 | 2000-10-11 | 2000-09-11 | 2000-08-11 | 2000-07-11 | 2000-06-11 | 2000-05-11 | 2000-04-11 | 2000-03-11 | 2000-02-11 | 2000-01-11 | 1999-12-11

Key: id Value: 540636

Key: archive Value: 2011-07-01

MESSAGE
DATE 2011-07-07
FROM Ruben Safir
SUBJECT Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
From owner-hangout-outgoing-at-mrbrklyn.com Thu Jul 7 02:07:10 2011
Return-Path:
X-Original-To: archive-at-mrbrklyn.com
Delivered-To: archive-at-mrbrklyn.com
Received: by www2.mrbrklyn.com (Postfix)
id DD98FDD892; Thu, 7 Jul 2011 02:07:09 -0400 (EDT)
Delivered-To: hangout-outgoing-at-www2.mrbrklyn.com
Received: by www2.mrbrklyn.com (Postfix, from userid 28)
id 0963456E53; Thu, 7 Jul 2011 02:07:08 -0400 (EDT)
Delivered-To: hangout-at-nylxs.com
Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89])
by www2.mrbrklyn.com (Postfix) with ESMTP id 6D70452A01
for ; Thu, 7 Jul 2011 02:07:08 -0400 (EDT)
Received: from panix2.panix.com (panix2.panix.com [166.84.1.2])
by mailbackend.panix.com (Postfix) with ESMTP id 9BDAF33F67
for ; Thu, 7 Jul 2011 02:07:08 -0400 (EDT)
Received: by panix2.panix.com (Postfix, from userid 20529)
id 6A8EE33C4A; Thu, 7 Jul 2011 02:07:08 -0400 (EDT)
From: Ruben Safir
To: hangout-at-nylxs.com
Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (NetBSD/5.1 (i386))
Message-Id: <20110707060708.6A8EE33C4A-at-panix2.panix.com>
Date: Thu, 7 Jul 2011 02:07:08 -0400 (EDT)
Sender: owner-hangout-at-mrbrklyn.com
Precedence: bulk
Reply-To: hangout-at-mrbrklyn.com

-- forwarded message --
Path: reader1.panix.com!panix!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!ecngs!feeder2.ecngs.de!78.46.240.70.MISMATCH!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: "Alf P. Steinbach /Usenet"
Newsgroups: comp.lang.c++
Subject: Re: iostream manipulator construction and design
Date: Wed, 06 Jul 2011 19:13:22 +0200
Organization: A noiseless patient Spider
Lines: 65
Message-ID:
References:
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 6 Jul 2011 17:10:27 +0000 (UTC)
Injection-Info: mx04.eternal-september.org; posting-host="iYQNcHckTm+srThRKCAVyQ";
logging-data="25967"; mail-complaints-to="abuse-at-eternal-september.org"; posting-account="U2FsdGVkX1/iPypTcapKOPG2Y7XybGp8"
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051201 Thunderbird/1.5 Mnenhy/0.7.3.0
In-Reply-To:
Cancel-Lock: sha1:CgimKg6AjwQeM5YaKeHSbslbeUY=
Xref: panix comp.lang.c++:1087338

* Ruben Safir, on 06.07.2011 17:01:
> On Wed, 06 Jul 2011 02:55:09 +0000, Ruben Safir wrote:
>
>> What don't understand a couple of things here, and this might be an
>> accumulation of increasing confusion on my part as I've continued
>> through this chapter.
>
> nobody with experience in this?

I'm guessing you didn't quite grok Michael's answer?

OK, it's not that hard. You just have to think about how you would have
implemented the design, where the design is that a manipulator expression such
as `setWidth(4)` can be "inserted" into the stream. It's a horrible design! :-)

But given that, well, `setWidth(4)` is a function call. As a function call it
produces some value. That value is inserted into the stream via <<.

So what value should `setWidth(4)` produce?

It must be a value that somehow remembers the `4`, and it must be a value that
isn't just presented as a number or something.

So, you let it be a value of some special class, like

struct MyWidthManip
{
int w_;
MyWidthManip( int w ): w_( w ) {}
};

Now you can define the function `setWidth`:

MyWidthManip setWidth( int w ) { return MyWidthManip( w ); }

Goodie, your call `setWidth( 4 )` produces an object of this class.

All you have to do now is to define the effect of inserting that into a stream:

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.

Bjarne's example of a support class was a bit more general than above, namely a
support class that supported many different one-int-argument manipulators. That
made it a little more complex. With some old C syntax function pointer
declaration thrown in -- I don't understand why he would do that in a book!


Cheers & hth.,

- Alf

--
blog at
-- end of forwarded message --

  1. 2011-07-01 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] (fwd) US-NY: Brooklyn-Sr Pipeline Corrosion
  2. 2011-07-01 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] (fwd) US-NY: Brooklyn-Sr Pipeline Corrosion
  3. 2011-07-01 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] (fwd) US-NY: Brooklyn-Sr Pipeline Corrosion
  4. 2011-07-02 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [ruben-at-mrbrklyn.com: Re: Fwd: Baruch Dayan HaEmes]
  5. 2011-07-02 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] HP Toouchpad is out
  6. 2011-07-03 From: "Paul Robert Marino" <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] HP Toouchpad is out
  7. 2011-07-03 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] HP Toouchpad is out
  8. 2011-07-04 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] HP Toouchpad is out
  9. 2011-07-05 swd <sderrick-at-optonline.net> Subject: [NYLXS - HANGOUT] "Cottage cheese sales plummet as Israeli consumers revolt over price"
  10. 2011-07-05 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday July 5 6:00PM-8:00PM
  11. 2011-07-05 Contrarian <adrba-at-nyct.net> Re: [NYLXS - HANGOUT] "Cottage cheese sales plummet as Israeli
  12. 2011-07-05 Elfen Magix <elfen_magix-at-yahoo.com> Subject: [NYLXS - HANGOUT] Death of Mom.
  13. 2011-07-05 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Death of Mom.
  14. 2011-07-05 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) iostream manipulator construction and design
  15. 2011-07-05 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) array initiation - methodology for converting C code to C++
  16. 2011-07-05 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [samantha-at-10gen.com: [New-York-C-Developers-Group] Next Meetup -
  17. 2011-07-05 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [samantha-at-10gen.com: [New-York-C-Developers-Group] Next Meetup -
  18. 2011-07-05 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] Death of Mom.
  19. 2011-07-05 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] "Cottage cheese sales plummet as Israeli consumers
  20. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] [rick-at-linuxmafia.com: [conspire] (forw) Re:
  21. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] OpenSuse 11.4
  22. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
  23. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) iostream manipulator construction and design
  24. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
  25. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
  26. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
  27. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
  28. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: iostream manipulator construction and design
  29. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) array initiation - methodology for converting C code to C++
  30. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: array initiation - methodology for converting C code to C++
  31. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: array initiation - methodology for converting C code to C++
  32. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Re: array initiation - methodology for converting C code to C++
  33. 2011-07-07 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] (fwd) Online C++ test
  34. 2011-07-08 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Quick before shabbos - please read
  35. 2011-07-13 einker <eminker-at-gmail.com> Subject: [NYLXS - HANGOUT] Fwd: Linux Engineer needed!
  36. 2011-07-14 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Presents: 7/24 -at- 12:00PM NYLUG on The NYLUG Summer Barbecue!
  37. 2011-07-17 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] Death in the family
  38. 2011-07-17 Ruben Safir <mrbrklyn-at-panix.com> Subject: [NYLXS - HANGOUT] NYC DoE
  39. 2011-07-17 Elfen Magix <elfen_magix-at-yahoo.com> Re: [NYLXS - HANGOUT] NYC DoE
  40. 2011-07-17 Elfen Magix <elfen_magix-at-yahoo.com> Re: [NYLXS - HANGOUT] Death in the family
  41. 2011-07-17 Ruben Safir <mrbrklyn-at-panix.com> Re: [NYLXS - HANGOUT] Death in the family
  42. 2011-07-17 Kevin Mark <kevin.mark-at-verizon.net> Re: [NYLXS - HANGOUT] Death in the family
  43. 2011-07-17 Kevin Mark <kevin.mark-at-verizon.net> Re: [NYLXS - HANGOUT] Death in the family
  44. 2011-07-18 einker <eminker-at-gmail.com> Re: [NYLXS - HANGOUT] Death in the family
  45. 2011-07-18 einker <eminker-at-gmail.com> Re: [NYLXS - HANGOUT] Death in the family
  46. 2011-07-18 Robert Menes <viewtiful.icchan-at-gmail.com> Re: [NYLXS - HANGOUT] Death in the family
  47. 2011-07-18 Paul Robert Marino <prmarino1-at-gmail.com> Re: [NYLXS - HANGOUT] Death in the family
  48. 2011-07-19 Ron Guerin <ron-at-vnetworx.net> Re: [NYLXS - HANGOUT] Death in the family
  49. 2011-07-19 Contrarian <adrba-at-nyct.net> Re: [NYLXS - HANGOUT] Death in the family
  50. 2011-07-19 Ron Guerin <ron-at-vnetworx.net> Subject: [NYLXS - HANGOUT] NYLUG Workshop / Hacking Society (Smalltalk, C++, Python) Tuesday July 19 6:00PM-8:00PM
  51. 2011-07-21 George Cluny <ceo.brooklyn-at-gmail.com> Subject: [NYLXS - HANGOUT] Join me on AIM!

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!