MySQL++: mysqlpp::Comparable< T > Class Template Reference
mysqlpp::Comparable< T > Class Template Referenceabstract

Mix-in that gives its subclass a full set of comparison operators. More...

`#include <comparable.h>`

Inheritance diagram for mysqlpp::Comparable< T >:
[legend]

## Public Member Functions

bool | operator== (const T &other) const
| Returns true if "other" is equal to this object.
bool | operator!= (const T &other) const
| Returns true if "other" is not equal to this object.
bool | operator< (const T &other) const
| Returns true if "other" is less than this object.
bool | operator<= (const T &other) const
| Returns true if "other" is less than or equal to this object.
bool | operator> (const T &other) const
| Returns true if "other" is greater than this object.
bool | operator>= (const T &other) const
| Returns true if "other" is greater than or equal to this object.

## Protected Member Functions

virtual | ~Comparable ()
| Destroy object. More...
virtual int | compare (const T &other) const =0
| Compare this object to another of the same type. More...

## Detailed Description

### template<class T>
class mysqlpp::Comparable< T >

Mix-in that gives its subclass a full set of comparison operators.

Simply by inheriting publically from this and implementing compare(), the subclass gains a full set of comparison operators, because all of the operators are implemented in terms of compare().

## Constructor & Destructor Documentation

## ~Comparable()

template<class T >

virtual mysqlpp::Comparable< T >::~Comparable | ( |  | ) |

inline protected virtual

Destroy object.

This class has nothing to destroy, but declaring the dtor virtual placates some compilers set to high warning levels. Protecting it ensures you can't delete subclasses through base class pointers, which makes no sense because this class isn't made for polymorphism. It's just a mixin.

## Member Function Documentation

## compare()

template<class T >

virtual int mysqlpp::Comparable< T >::compare | ( | const T & | other | ) | const

protected pure virtual

Compare this object to another of the same type.

Returns < 0 if this object is "before" the other, 0 of they are equal, and > 0 if this object is "after" the other.

Implemented in mysqlpp::Time, mysqlpp::DateTime, and mysqlpp::Date.

Referenced by mysqlpp::Comparable< T >::operator!=(), mysqlpp::Comparable< T >::operator<(), mysqlpp::Comparable< T >::operator<=(), mysqlpp::Comparable< T >::operator==(), mysqlpp::Comparable< T >::operator>(), and mysqlpp::Comparable< T >::operator>=().

The documentation for this class was generated from the following file:

- comparable.h