- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | List of all members
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

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

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::Date, and mysqlpp::DateTime.

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

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

- comparable.h