
13 Nov
2005
13 Nov
'05
3:09 p.m.
Gennadiy Rozental wrote:
Ok. So be it. Actually An ideal solution would be somethind like:
BOOST_CHECK_CLOSE( a, b , 0.5% ) - test in percents BOOST_CHECK_CLOSE( a, b , 0.05) - test in epsilon
But I couldn't figure out how implement it
Maybe this idea helps: #include <iostream> using namespace std; struct Null { Null operator+() const { return Null(); } } null; template< typename T > T operator+( const T& v, const Null& ) { return v; } template< typename T > T operator%( const T& v, const Null& ) { return v / 100; } #define TEST( X ) (X+null) int main() { cout << TEST( 0.5% ) << endl << TEST( 0.05 ) << endl; } Regards, Daniel