csArrayCmp< T, K > Class Template Reference
A functor template which encapsulates a key and a comparison function for use with key-related csArray<> searching methods, such as FindKey() and FindSortedKey(). More...
#include <array.h>
Public Types | |
typedef int(* | CF )(T const &, K const &) |
Type of the comparison function which compares a key against an element contained in a csArray<>. | |
Public Methods | |
csArrayCmp (K const &k, CF c=DefaultCompare) | |
Construct a functor from a search key and a comparison function. | |
csArrayCmp (csArrayCmp const &o) | |
Construct a functor from another functor. | |
csArrayCmp & | operator= (csArrayCmp const &o) |
Assign another functor to this one. | |
int | operator() (T const &r) const |
Invoke the functor. | |
operator CF () const | |
Return the comparison function with which this functor was constructed. | |
operator K const & () const | |
Return the key with which this functor was constructed. | |
Static Public Methods | |
int | DefaultCompare (T const &r, K const &k) |
Compare two objects of the same type or different types (T and K). |
Detailed Description
template<class T, class K>
class csArrayCmp< T, K >
A functor template which encapsulates a key and a comparison function for use with key-related csArray<> searching methods, such as FindKey() and FindSortedKey().
Being a template instaniated upon two (possibly distinct) types, this allows the searching methods to perform type-safe searches even when the search key type differs from the contained element type. The supplied search function defines the relationship between the search key and the contained element.
Definition at line 85 of file array.h.
Member Typedef Documentation
|
Type of the comparison function which compares a key against an element contained in a csArray<>. T is the type of the contained element. K is the type of the search key. Definition at line 93 of file array.h. Referenced by csArrayCmp< T, K >::csArrayCmp(). |
Constructor & Destructor Documentation
|
Construct a functor from a search key and a comparison function.
Definition at line 95 of file array.h. References csArrayCmp< T, K >::CF, and csArrayCmp< T, K >::DefaultCompare(). |
|
Construct a functor from another functor.
|
Member Function Documentation
|
Compare two objects of the same type or different types (T and K).
Definition at line 124 of file array.h. References csOrdering< T1, T2 >::Compare(). Referenced by csArrayCmp< T, K >::csArrayCmp(). |
|
Return the comparison function with which this functor was constructed.
|
|
Return the key with which this functor was constructed.
|
|
Invoke the functor.
|
|
Assign another functor to this one.
Definition at line 99 of file array.h. References csArrayCmp< T, K >::cmp, and csArrayCmp< T, K >::key. |
The documentation for this class was generated from the following file:
- csutil/array.h
Generated for Crystal Space by doxygen 1.2.18