Boost logo

Boost :

From: John Torjo (john.lists_at_[hidden])
Date: 2005-04-26 05:14:32


Felipe Magno de Almeida wrote:

> I mean something like:
>
> #ifndef NDEBUG
> inline
> #endif
> log_stream &operator <<(log_stream &stream, int i)
> {
> #ifdef NDEBUG
> code that puts the int in the stream
> #endif
> return stream;
> }
> I dont see why a compiler would be passing the stream around, mainly
> with the operator being inline.
> That way we dont need to use macros in the client code, that makes the
> code a little ugly in my opinion...
> The only problem that I see is for:
> stream << "testing";
> where at least in my compiler (VC7.1) these strings are shipped even
> when not used... for embedded systems these strings really get the
> code much bigger... As I've tried it with BREW...
>

And let's not forget:

stream << long_computing_func();

Best,
John

-- 
John Torjo,    Contributing editor, C/C++ Users Journal
-- "Win32 GUI Generics" -- generics & GUI do mix, after all
-- http://www.torjo.com/win32gui/ -v1.6.3 (Resource Splitter)
-- http://www.torjo.com/cb/ - Click, Build, Run!

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk