Jean-Marc Lasgouttes wrote: >>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> >>>>>> writes: > > Angus> It looks to me like you're describing formatting flags (iomanip > Angus> thingies) rather than member functions as they affect only the > Angus> next piece of input rather than everything thereafter. > > You are right. > > Angus> They are actually dead easy to implement. Below is the g++ > Angus> implementation of 'setw' > > Urgh. You meant dead unreadable, right?
Nonsense. Ignore the leading underscores. All it does is: 1. Define a struct Setw with a single int member variable: struct Setw { int w; } 2. Define a maipulator that returns a Setw object: Setw setw(int w) { Setw sw; sw.w = w; return sw; } 3. Define an operator<< that receives an ostream and a Setw object in order to set the width variable of the ostream: std::ostream & operator<<(std::ostream & os, Setw const & sw) { os.width(sw.w); return os; } What's hard about that? > Angus> However, I don't think that we need to define a new > Angus> olatexstream with member functions unwantedligature() etc. That > Angus> would be difficult because sometimes we'd want olatexstream to > Angus> derive from ofstream, sometimes from ostringstream, etc. > > I planned to use the basic stupid way of passing a ostream in the > constructor as the underlying stream. Good idea actually and not stupid at all. You'll still need the above, but operator<< will take an olatexstream as it's first argument. I see. > Angus> For the way forward, see > > Angus> > http://www.awprofessional.com/articles/article.asp?p=171014&seqNum=2 > > It looks a bit like a hack, don't you think? Especially since I need > more that longs and casting all over the place is ugly. Or I could use > this long to a pointer (is this always possible) to a structure > containing my entries. I don't think that the xalloc, iword, pword stuff is a hack. Their interface to it and to using it is, but that's another thing. Anyway, your way is much nicer, and I hope you now see that it's very easy to implement. -- Angus