Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Cmp Class Template Reference

#include <Cmp.hh>

List of all members.


Detailed Description

template<typename T>
class Rivet::Cmp< T >

Cmp is a helper class to be used when checking the ordering of two objects. When implicitly converted to an integer the value will be negative if the two objects used in the constructor are ordered and positive if they are not. Zero will be returned if they are equal.

The main usage of the Cmp class is if several variables should be checked for ordering in which case several Cmp objects can be combined as follows: cmp(a1, a2) || cmp(b1, b2) || cmp(c1, c2) where cmp is a global function for easy creation of Cmp objects.

Definition at line 24 of file Cmp.hh.


Public Types

enum  CmpState { undefined = -2, ordered = -1, equivalent = 0, unordered = 1 }
 Enumerate the possible states of a Cmp object. More...

Public Member Functions

 operator int () const
 Automatically convert to an integer.
template<typename U>
const Cmp< T > & operator|| (const Cmp< U > &c) const
 If this state is equivalent, set this state to the state of c.
Standard constructors and destructors.
 Cmp (const T &t1, const T &t2)
 The default constructor.
template<typename U>
 Cmp (const Cmp< U > &)
 The copy constructor.
 ~Cmp ()
 The destructor is not virtual since this is not intended to be a base class.
template<typename U>
const Cmp< T > & operator= (const Cmp< U > &)
 The assignment operator.

Member Enumeration Documentation

enum CmpState
 

Enumerate the possible states of a Cmp object.

Enumeration values:
undefined 
ordered 
equivalent 
unordered 

Definition at line 29 of file Cmp.hh.


Constructor & Destructor Documentation

Cmp const T &  t1,
const T &  t2
[inline]
 

The default constructor.

Definition at line 168 of file Cmp.hh.

Cmp const Cmp< U > &   )  [inline]
 

The copy constructor.

Definition at line 173 of file Cmp.hh.

~Cmp  )  [inline]
 

The destructor is not virtual since this is not intended to be a base class.

Definition at line 48 of file Cmp.hh.


Member Function Documentation

operator int  )  const [inline]
 

Automatically convert to an integer.

Definition at line 192 of file Cmp.hh.

const Cmp< T > & operator= const Cmp< U > &   )  [inline]
 

The assignment operator.

Definition at line 178 of file Cmp.hh.

const Cmp< T > & operator|| const Cmp< U > &  c  )  const [inline]
 

If this state is equivalent, set this state to the state of c.

Definition at line 185 of file Cmp.hh.


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