Article View: comp.std.c++
Article #699Re: ios::iword, ios::pword, ios::xalloc
From: Lewis G. Pringle
Date: Mon, 12 Oct 1992 18:14
Date: Mon, 12 Oct 1992 18:14
42 lines
2220 bytes
2220 bytes
In article <1992Oct8.234902.12170@lucid.com> jss@lucid.com (Jerry Schwarz) writes: >These functions are intended to support extension of stream types >without requiring derivation. My claim is that this is useful because >the actual type of a stream is lost in an expression involving insertions >or extractions. That is > > mystream m ; > m << y << mymanipulator ; > >You can't declare > > mystream& mymanipulator(mystream&) ; > >because it's argument is an ostream&, not a mystream&. However mymanipulator >can look into the infinite arrays for any useful information put there >by the mystream constructor. Could you please elaborate even further. A long standing problem with the isotream library, from my point of view, was that roughly half the time I wanted the interpretation of inserters to be that it inserted a "pretty" form of the item, and the other half of the time I wanted the interpretation to be to insert an EXTRACTABLE represenation of the item. This "pretty" form is most often useful when preparing to display some object, or when writting out debug info. The EXTRACTABLE version is most useful when saving and restoring to a file. I've experimented with hacks like global variables, etc, but what I really wanted was the ability to "add a boolean" into the iostream so that each inserter could write things out appropriately. Ideally I would want the predefiend inserters and extractors (eg int) to also pay attention to this boolean. Could the iword/pword mechanism be used to achieve this? Do you know of some better mechanism to achieve this? How are you supposed to actually use the iword/pword mechanism? Where is it documented? Lewis. -- Reading peoples signatures is a real waste of time. lewis@sophists.com (Lewis Gordon Pringle, Jr.)
Technical Details
Message-ID:
<1992Oct12.181426.28738@sophists.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!sophists.com!lewisReferences:
<1992Oct8.234902.12170@lucid.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++,comp.lang.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!sophists.com!lewis From: lewis@sophists.com (Lewis G. Pringle) Subject: Re: ios::iword, ios::pword, ios::xalloc Message-ID: <1992Oct12.181426.28738@sophists.com> Date: Mon, 12 Oct 1992 18:14:26 GMT References: <1992Oct8.234902.12170@lucid.com> Organization: Sophist Solutions Lines: 42