POV-Ray : Newsgroups : povray.off-topic : Error mesage : Re: Error mesage Server Time
7 Sep 2024 19:15:57 EDT (-0400)
  Re: Error mesage  
From: Fredrik Eriksson
Date: 4 May 2008 07:30:56
Message: <op.uamnltkn7bxctx@e6600.bredbandsbolaget.se>
On Sun, 04 May 2008 03:39:20 +0200, Darren New <dne### [at] sanrrcom> wrote:
> Here's something I've been wondering about that. Say you have your own
  

> type, and you want a set of flags like hex/oct/decimal or setfill or  

> something like that. I.e., you want to be able to say
>
> std::cout << prettyprintindent(4) << myvalue << "\n";
>
> Where does the "4" there get stored?

Did you not ask this once before?

http://groups.google.com/group/comp.lang.c++.moderated/search?q=custom
+stream+manipulator

Also, look up 'ios::xalloc'.



> And how can you make it so that (say) passing -1 puts back what it was
  

> before the previous call for the same stream?

http://www.boost.org/doc/libs/1_35_0/libs/io/doc/ios_state.html#user_sav
ers

Perhaps not exactly what you meant, but doing it this way avoids resourc
e  

management issues.


> It would seem that you'd need some sort of data structure mapping stre
ams
> to pretty print indent levels, yes? And no automated way of cleaning t
hat
> up with a destructor?

If you impose a fixed (and relatively small) limit on the history size, 
 

you could store all the relevant information in the stream itself. For  

automatic cleanup of arbitrary amounts of per-stream data, I think you  

might need to use custom streams.


-- 

FE


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.