## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csComparator< T1, T2 > Class Template Reference
[Containers]

A template providing various comparison and ordering functions. More...

`#include <csutil/comparator.h>`

List of all members.

## Static Public Member Functions

static int | Compare (T1 const &r1, T2 const &r2)
| Compare two objects of the same type or different types (T1 and T2).

## Detailed Description

### template<class T1, class T2>
class csComparator< T1, T2 >

A template providing various comparison and ordering functions.

Definition at line 35 of file comparator.h.

## Member Function Documentation

template<class T1, class T2>
static int csComparator< T1, T2 >::Compare | ( | T1 const & | r1,
|  | T2 const & | r2
| ) | `[inline, static]`

Compare two objects of the same type or different types (T1 and T2).

Parameters:

  | r1 | Reference to first object.
  | r2 | Reference to second object.

Returns:
  Zero if the objects are equal; less-than-zero if the first object is less than the second; or greater-than-zero if the first object is greater than the second.

Remarks:
  Assumes the existence of T1::operator<(T2) and T2::operator<(T1). If T1 and T2 are the same type T, then only T::operator<(T) is assumed (naturally).

  This is the default comparison function used by csArray<> for searching and sorting if the client does not provide a custom function. It is also used by csSet<> when checking for object containment.

Definition at line 54 of file comparator.h.

Referenced by csComparator< csRGBcolor *, csRGBcolor * >::Compare(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::DefaultCompare(), csArrayCmp< userbuffer, csStringID >::DefaultCompare(), csRedBlackTree< csRedBlackTreePayload< K, T > >::LocateNode(), csRedBlackTree< csRedBlackTreePayload< K, T > >::RecursiveFind(), and csRedBlackTree< csRedBlackTreePayload< K, T > >::RecursiveInsert().

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

- csutil/comparator.h