|
Boost : |
From: John Torjo (john_at_[hidden])
Date: 2003-05-08 06:57:53
> #include <iostream>
>
> struct Keeper
> {
> Keeper(int) {}
> operator bool() { return false; }
>
> template< class type>
> void log( const type & val, const char * str)
> { std::clog << str << "=" << val; }
> };
>
> template< class type>
> struct log_me_t
> {
> log_me_t( const value & val, const char * str, Keeper & k)
> : m_val( val)
> { k.log( val, str); }
>
> const type & m_val;
> };
>
> template< class type> log_me_t< type> log_me( const type & val, const char
*
> str, Keeper & k)
> { return log_me_t< type>( val, str, k); }
>
> #define BOOST_ASSERT(expr)
> if ( Keeper k=0 ) ; \
> else if ( (expr) ) ; \
> else \
> <like before> \
>
> #define v_(x) log_me(x, #x, k).ref
Pardon me, it should be:
#define v_(x) log_me(x, #x, k).m_val
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk