Previous section   Next section

Imperfect C++ Practical Solutions for Real-Life Programming
By Matthew Wilson
Table of Contents
Chapter 29.  Arithmetic Types


29.7. Comparison Operators

The comparison operators can be implemented in exactly the same way as the arithmetic operators, with nonmember binary operators implemented in terms of member functions:



bool operator ==( UInteger64 const &lhs


                , UInteger64 const &rhs)


{


  return lhs.IsEqual(rhs);


}


bool operator <( UInteger64 const &lhs


               , UInteger64 const &rhs)


{


  return lhs.Compare(rhs) < 0;


}




      Previous section   Next section