00001 #ifndef COMPARE_TO_OPERATORS_HPP_
00002 #define COMPARE_TO_OPERATORS_HPP_
00003
00004 namespace ariba {
00005 namespace addressing {
00006 namespace detail {
00007
00008
00014 template<class T>
00015 class compare_to_operators {
00016 public:
00018 inline bool operator==( const T& rhs ) const {
00019 return static_cast<const T*>(this)->compare_to(rhs) == 0;
00020 }
00021
00023 inline bool operator!=( const T& rhs ) const {
00024 return static_cast<const T*>(this)->compare_to(rhs) != 0;
00025 }
00026
00028 inline bool operator<( const T& rhs ) const {
00029 return static_cast<const T*>(this)->compare_to(rhs) < 0;
00030 }
00031
00033 inline bool operator<=( const T& rhs ) const {
00034 return static_cast<const T*>(this)->compare_to(rhs) <= 0;
00035 }
00036
00038 inline bool operator>( const T& rhs ) const {
00039 return static_cast<const T*>(this)->compare_to(rhs) > 0;
00040 }
00041
00043 inline bool operator>=( const T& rhs ) const {
00044 return static_cast<const T*>(this)->compare_to(rhs) >= 0;
00045 }
00046 };
00047
00048 }}}
00049
00050 #endif