Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2003-09-25 07:24:32


On Thu, 25 Sep 2003 Lars Gullik Bjønnes wrote

> Jeff Garland wrote:
> > My approach was a bit different in that I didn't bother with the buffer at
> > all, but created the ostream interface directly in hope that the

>But if you are going to compile anyway, then you could use other
>methods as well (pre-processor).

Yes, but macros are evil and impact code readability. I just really hate lots
of code like:
  
  TRACE("I'm here" << foo << std::endl);

The all caps thing is really bothersome to me. And of course there is the
loss of ability to set have a tracing version and a non-tracing version in one
 compilation unit.

> How will this behave for user defined types?

Same because of omitted detail below...

> Do I have to add a operator<< for both ostream and null_ostream?

No...

template<class T>
null_ostream&
operator<<(null_ostream& os, const T&)
{
  return os;
}

I'm not saying my idea was fully baked -- there may be some fatal flaw I
haven't worked out. Just wanted to point out other potential approaches and
requirements while expressing support for getting something like this in boost.

Jeff


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