Tue Mar 19 05:46:11 2024
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

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

Key: Value:

Key: Value:

MESSAGE
DATE 2011-07-07
FROM Ruben Safir
SUBJECT Subject: [NYLXS - HANGOUT] (fwd) iostream manipulator construction and design
-- forwarded message --
Path: reader1.panix.com!panix!not-for-mail
From: Ruben Safir
Newsgroups: comp.lang.c++
Subject: iostream manipulator construction and design
Date: Wed, 6 Jul 2011 02:55:09 +0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Lines: 67
Message-ID:
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 1309920909 10928 96.57.23.82 (6 Jul 2011 02:55:09 GMT)
X-Complaints-To: abuse-at-panix.com
NNTP-Posting-Date: Wed, 6 Jul 2011 02:55:09 +0000 (UTC)
User-Agent: Pan/0.133 (House of Butterflies)
Xref: panix comp.lang.c++:1087303

I've covered the iostream operations in Stroustrup but there is a section
that I'm failing to understand in section 21.4.6.1 (of the third edition
of C++ - The Programming Language) which I hope that someone can help
me decipher. The section discusses Manipultors that take arguments and
Stroustrup states


"Manipulators that take arguments can also be useful. For example, we
might want to write

cout << setprecision(4) << angle;

to print the value of the floating-point variable angle with four
digits.

To do this, setprecision must return an object that is initialized by 4
and that calls cout::setprcision when involked. Such a manipulator is a
function object thatr is involed by << rather than by (). The exact
tyoe of function object is implementation-defined, but it might be
defined like this:

struct smanip{
ios_base& (*f)(ios_base&, int); //function to be called
int i;

smanip(ios_base& (*ff) (ios_base&, int), int ii) : f(ff, i(ii){}
};

template
ostream& operator<<(ostream& os, smanip& m)
{
return m.f(os, m.i);
}

The smanip constructor stores its arguments in f and i and the
operator<< calls f(i). We can now define setprecision() like this:

ios_base& set_precision(ios)base& s, int n) //helper
{
return s.setprecision(n); //call member function
}

inline smap setprecision(int n)
{
return smanip(set_precision, n);
}

We can now write:
cout << setprecision(4) << angle;
"


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.

First, I just don't understand what the problem is that is being solved.
Why can't a manipulator just take an argument of an int and return a
base_stream object, like the manipulators that don't take an argument?

Secondly, the exqmple completely befuddles me. I'm guessing that don't
understand the order of operations of

cout << setprecision(4) << angle;

is ostream<< called first and then the function setprecision?

-- 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!