Comparison Operators

ntuple<> supports all the comparison operators ==, !=, <, <=, > and >=

ntuple< int, int, int > a( 1, 2, 3 ), b( 2, 0, 0 ), c( a );

CHECK( a != b );
CHECK( a == c );

std::cout << std::boolalpha << a << " (op) " << b << '\n';
std::cout << "== " << (a == b) << '\n';
std::cout << "!= " << (a != b) << std::endl;

a = ntuple_( 3, 2, 1 ), b = ntuple_( 3, 2, 0 );

CHECK( a > b && a >= b && b < a && b <= a );
CHECK( !(a < b) && !(a <= b) && !(b > a) && !(b >= a) );

std::cout << std::boolalpha << a << " op " << b;
std::cout
  << "\n<  " << ( a < b )
  << "\n<= " << ( a <= b )
  << "\n>  " << ( a > b )
  << "\n>= " << ( a >= b )
  << std::endl
;

Test Result: gcc34 Passed, msvc80 Passed, msvc71 Passed

Output

(1,2,3) (op) (2,0,0)
== false
!= true
(3,2,1) op (3,2,0)
<  false
<= false
>  true
>= true

More on Comparisons ...

[1]This "Short circuiting" is provided by the inbuilt operator &&.