libmoost
moost::utils::relops< T > Class Template Reference

Sub-class this to implement relops in your class. More...

#include <relops.hpp>

List of all members.

Public Member Functions

template<typename U >
bool operator== (U const &rhs) const
 Equality operator.
template<typename U >
bool operator< (U const &rhs) const
 Less-than operator.
template<typename U >
bool operator!= (U const &rhs) const
 In-equality operator.
template<typename U >
bool operator> (U const &rhs) const
 Greater-than operator.
template<typename U >
bool operator<= (U const &rhs) const
 Less-than or equal.
template<typename U >
bool operator>= (U const &rhs) const
 Greater-than or equal operator.

Protected Member Functions

 relops ()

Friends

template<typename U >
bool operator== (U const &lhs, T const &rhs)
template<typename U >
bool operator< (U const &lhs, T const &rhs)
template<typename U >
bool operator!= (U const &lhs, T const &rhs)
template<typename U >
bool operator> (U const &lhs, T const &rhs)
template<typename U >
bool operator<= (U const &lhs, T const &rhs)
template<typename U >
bool operator>= (U const &lhs, T const &rhs)

Detailed Description

template<typename T>
class moost::utils::relops< T >

Sub-class this to implement relops in your class.

Template Parameters:
TThe type being compared
Note:
Each operator takes its rhs as a type U, meaning that as long as T has implemented a == and < for type U it will be able to handle all the others (!=, >, <= & >=) for free

This framework isn't meant as a replacement for the Boost operators library; rather, it serves the single job of making the addition of relationship operators to a class as trivial as possible. Your class just exposes '==' and '<' and then sub-classs relops<T>. It will then get support for all relationship operators, both ways.

ie. X cmp Y and Y cmp X (where cmp is a relationship operator)

Definition at line 60 of file relops.hpp.


Constructor & Destructor Documentation

template<typename T >
moost::utils::relops< T >::relops ( ) [inline, protected]

Definition at line 63 of file relops.hpp.


Member Function Documentation

template<typename T >
template<typename U >
bool moost::utils::relops< T >::operator!= ( U const &  rhs) const [inline]

In-equality operator.

Parameters:
rhsThe right hand side value
Returns:
lhs != rhs
Note:
You get this for free

Definition at line 124 of file relops.hpp.

Here is the call graph for this function:

template<typename T >
template<typename U >
bool moost::utils::relops< T >::operator< ( U const &  rhs) const [inline]

Less-than operator.

Parameters:
rhsThe right hand side value
Returns:
true if lhs < rhs
Note:
You need to implement this

Definition at line 100 of file relops.hpp.

Here is the caller graph for this function:

template<typename T >
template<typename U >
bool moost::utils::relops< T >::operator<= ( U const &  rhs) const [inline]

Less-than or equal.

Parameters:
rhsThe right hand side value
Returns:
lhs <= rhs
Note:
You get this for free

Definition at line 170 of file relops.hpp.

Here is the call graph for this function:

template<typename T >
template<typename U >
bool moost::utils::relops< T >::operator== ( U const &  rhs) const [inline]

Equality operator.

Parameters:
rhsThe right hand side value
Returns:
true if lhs == rhs
Note:
You need to implement this

Definition at line 77 of file relops.hpp.

Here is the caller graph for this function:

template<typename T >
template<typename U >
bool moost::utils::relops< T >::operator> ( U const &  rhs) const [inline]

Greater-than operator.

Parameters:
rhsThe right hand side value
Returns:
lhs > rhs
Note:
You get this for free

Definition at line 147 of file relops.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
template<typename U >
bool moost::utils::relops< T >::operator>= ( U const &  rhs) const [inline]

Greater-than or equal operator.

Parameters:
rhsThe right hand side value
Returns:
lhs >= rhs
Note:
You get this for free

Definition at line 193 of file relops.hpp.

Here is the call graph for this function:


Friends And Related Function Documentation

template<typename T >
template<typename U >
bool operator!= ( U const &  lhs,
T const &  rhs 
) [friend]

Definition at line 130 of file relops.hpp.

template<typename T >
template<typename U >
bool operator< ( U const &  lhs,
T const &  rhs 
) [friend]

Definition at line 107 of file relops.hpp.

template<typename T >
template<typename U >
bool operator<= ( U const &  lhs,
T const &  rhs 
) [friend]

Definition at line 176 of file relops.hpp.

template<typename T >
template<typename U >
bool operator== ( U const &  lhs,
T const &  rhs 
) [friend]

Definition at line 84 of file relops.hpp.

template<typename T >
template<typename U >
bool operator> ( U const &  lhs,
T const &  rhs 
) [friend]

Definition at line 153 of file relops.hpp.

template<typename T >
template<typename U >
bool operator>= ( U const &  lhs,
T const &  rhs 
) [friend]

Definition at line 199 of file relops.hpp.


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