ModErn Text Analysis
META Enumerates Textual Applications
Private Member Functions | Friends | List of all members
meta::util::comparable< Derived > Class Template Reference

A CRTP base class that allows for inheritance of all comparator operators given that the derived class defines an operator<(). More...

#include <comparable.h>

Private Member Functions

const Derived & as_derived () const
 Helper method to cast the current comparable to its Derived representation. More...
 

Friends

bool operator== (const comparable &lhs, const comparable &rhs)
 Determines if two comparables are equivalent, as defined by their operator<. More...
 
bool operator!= (const comparable &lhs, const comparable &rhs)
 Determines if two comparables are not equivalent, as defined by negation of the comparable::operator==. More...
 
bool operator> (const comparable &lhs, const comparable &rhs)
 
bool operator<= (const comparable &lhs, const comparable &rhs)
 
bool operator>= (const comparable &lhs, const comparable &rhs)
 

Detailed Description

template<class Derived>
class meta::util::comparable< Derived >

A CRTP base class that allows for inheritance of all comparator operators given that the derived class defines an operator<().

All operations are defined in terms of Derived's operator<().

Member Function Documentation

template<class Derived>
const Derived& meta::util::comparable< Derived >::as_derived ( ) const
inlineprivate

Helper method to cast the current comparable to its Derived representation.

Returns
the Derived form of the current comparable

Friends And Related Function Documentation

template<class Derived>
bool operator== ( const comparable< Derived > &  lhs,
const comparable< Derived > &  rhs 
)
friend

Determines if two comparables are equivalent, as defined by their operator<.

Parameters
lhs
rhs
Returns
whether lhs == rhs
template<class Derived>
bool operator!= ( const comparable< Derived > &  lhs,
const comparable< Derived > &  rhs 
)
friend

Determines if two comparables are not equivalent, as defined by negation of the comparable::operator==.

Parameters
lhs
rhs
Returns
whether lhs != rhs
template<class Derived>
bool operator> ( const comparable< Derived > &  lhs,
const comparable< Derived > &  rhs 
)
friend
Parameters
lhs
rhs
Returns
whether lhs > rhs, as defined by their operator<.
template<class Derived>
bool operator<= ( const comparable< Derived > &  lhs,
const comparable< Derived > &  rhs 
)
friend
Parameters
lhs
rhs
Returns
whether lhs <= rhs, as defined by their operator< and comparable::operator==.
template<class Derived>
bool operator>= ( const comparable< Derived > &  lhs,
const comparable< Derived > &  rhs 
)
friend
Parameters
lhs
rhs
Returns
whether lhs >= rhs, as defined by comparable::operator> and comparable::operator==.

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