imp::unsigned_int< Bits > supports unary and binary operator - () and binary operator -= ().
Unary operator - () returns a negetive copy of the object it was called upon.
See the description of operator + () for description's of the behaviour of binary operator's - and -=.
unsigned_int< 128 > a( 10 ), b( -1 ), c( 20 ); unsigned u = 10; CHECK( -c == -20 ); c -= a; CHECK( c == 10 ); CHECK( ( c - a ) == 0 ); CHECK( ( c - 20 ) == -10 ); CHECK( ( 20 - c ) == +10 ); c = 0 - a; CHECK( c == (-a) ); u = a; u -= a; CHECK( u == 0 );
Test Result: gcc34 Passed, msvc80 Passed, msvc71 Passed
Output
Ok