ORIGINAL
Loading...
Searching...
No Matches
Public Member Functions | List of all members
original::comparable< DERIVED > Class Template Referenceabstract

Base class for comparable objects. More...

#include <comparable.h>

Inheritance diagram for original::comparable< DERIVED >:
Inheritance graph
Collaboration diagram for original::comparable< DERIVED >:
Collaboration graph

Public Member Functions

virtual integer compareTo (const DERIVED &other) const =0
 Compares the current object with another of the same type.
 
bool operator== (const DERIVED &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const DERIVED &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const DERIVED &other) const
 Checks if the current object is less than another.
 
bool operator> (const DERIVED &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const DERIVED &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const DERIVED &other) const
 Checks if the current object is greater than or equal to another.
 
virtual ~comparable ()=default
 Virtual destructor for proper cleanup of derived objects.
 

Detailed Description

template<typename DERIVED>
class original::comparable< DERIVED >

Base class for comparable objects.

Template Parameters
DERIVEDThe type of the derived class.

This class defines a compareTo() method that must be implemented by derived classes to compare their instances. It also provides common comparison operators (==, !=, <, >, <=, >=) based on the compareTo() method.

Derived classes are expected to override compareTo() to return:

Classes implementing this interface automatically satisfy the CmpTraits concept.

See also
CmpTraits

Member Function Documentation

◆ compareTo()

template<typename DERIVED >
virtual integer original::comparable< DERIVED >::compareTo ( const DERIVED other) const
pure virtual

Compares the current object with another of the same type.

Parameters
otherThe object to compare against.
Returns
A negative value if less than, zero if equal, and positive if greater than.

Implemented in original::autoPtr< TYPE, DERIVED, DELETER >, original::containerAdapter< TYPE, SERIAL, ALLOC >, original::couple< F_TYPE, S_TYPE >, original::iterationStream< TYPE, DERIVED >, and original::iterator< TYPE >.

◆ operator!=()

Checks if the current object is not equal to another.

Parameters
otherThe object to compare against.
Returns
True if not equal, otherwise false.

◆ operator<()

template<typename DERIVED >
auto original::comparable< DERIVED >::operator< ( const DERIVED other) const

Checks if the current object is less than another.

Parameters
otherThe object to compare against.
Returns
True if less than, otherwise false.

◆ operator<=()

template<typename DERIVED >
auto original::comparable< DERIVED >::operator<= ( const DERIVED other) const

Checks if the current object is less than or equal to another.

Parameters
otherThe object to compare against.
Returns
True if less than or equal, otherwise false.

◆ operator==()

template<typename DERIVED >
auto original::comparable< DERIVED >::operator== ( const DERIVED other) const

Checks if the current object is equal to another.

Parameters
otherThe object to compare against.
Returns
True if equal, otherwise false.

◆ operator>()

template<typename DERIVED >
auto original::comparable< DERIVED >::operator> ( const DERIVED other) const

Checks if the current object is greater than another.

Parameters
otherThe object to compare against.
Returns
True if greater than, otherwise false.

◆ operator>=()

template<typename DERIVED >
auto original::comparable< DERIVED >::operator>= ( const DERIVED other) const

Checks if the current object is greater than or equal to another.

Parameters
otherThe object to compare against.
Returns
True if greater than or equal, otherwise false.

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