ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
Re: [boost] streams - basic_nullbuf
by =?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?= other posts by this author
Sep 25 2003 11:47AM messages near this date
Re: [boost] streams - basic_nullbuf | Re: [boost] streams - basic_nullbuf
"Jeff Garland" <jeff@[...].com>  writes:

| 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 compiler
| could obviously optimize out any calls to the stream output.  This would allow
| me to insert tracing in time sensitive code and expect that when I replace it
| will null ostream the code would be totally optimized away -- costing nothing
| in space or time.

But if you are going to compile anyway, then you could use other
methods as well (pre-processor).
 
| //The essence of the idea...
| //no char templates for simplicity of illustration
| class null_ostream : public std::ostream {
| public:
|   null_ostream() {};
> 
|   //various required overloads...
|   null_ostream& operator <<(bool) 
|   {
|     return *this;
|   }
|   null_ostream& operator <<(short) 
|   {
|     return *this;
|   }
|   //... and many more ....

How will this behave for user defined types?
Do I have to add a operator<< for both ostream and null_ostream?

-- 
	Lgb
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
John Torjo
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
Gennadiy Rozental
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
Jeff Garland
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
Jeff Garland
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
Jeff Garland
Jeff Garland
Samuel Krempp
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
=?iso-8859-1?q?Lars_Gullik_Bj=F8nnes?=
val salamakha
Ulrich Eckhardt
val salamakha

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved