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

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

Friends

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

§ as_derived()

template<class Derived>
constexpr 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

§ operator==

template<class Derived>
constexpr 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

§ operator!=

template<class Derived>
constexpr 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

§ operator>

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

§ operator<=

template<class Derived>
constexpr 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==.

§ operator>=

template<class Derived>
constexpr 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: