ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Friends | List of all members
qip::Comparison< T, U >

Helper template for comparisons. Derive from this to provide !=,>,<=,>=, given == and <. More...

#include <Template.hpp>

Friends

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

Detailed Description

template<typename T, typename U = T>
class qip::Comparison< T, U >

Helper template for comparisons. Derive from this to provide !=,>,<=,>=, given == and <.

If you have a class, C, derive publically from this, with T=C. Then, just implement '==' and '<' operators, to magically get all of these.

class C : public qip::Comparison<C> { ... friend bool operator==(const C &lhs, const C &rhs); friend bool operator<(const C &lhs, const C &rhs); };

Can have different types for LHS and RHS, e.g.:

class D : public qip::Comparison<D>, qip::Comparison<D,C>, qip::Comparison<C,D> { ... friend bool operator==(const D &lhs, const D &rhs); friend bool operator<(const D &lhs, const D &rhs); friend bool operator==(const D &lhs, const C &rhs); friend bool operator<(const D &lhs, const C &rhs); friend bool operator==(const C &lhs, const D &rhs); friend bool operator<(const C &lhs, const D &rhs); };


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