Jpp
Public Member Functions | Public Attributes | List of all members
JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::JComparator Struct Reference

Auxiliary class for ordering of objects in the collection by the hash value of their keys. More...

#include <JHashMap.hh>

Public Member Functions

 JComparator (const JEvaluator_t &evaluator=JEvaluator_t())
 Constructor. More...
 
bool operator() (typename JClass< value_type >::argument_type first, typename JClass< value_type >::argument_type second) const
 Comparison of elements. More...
 
bool operator() (typename JClass< value_type >::argument_type element, typename JClass< key_type >::argument_type x) const
 Comparison of element and key value. More...
 

Public Attributes

JEvaluator_t getValue
 Function object for evaluation of key. More...
 

Detailed Description

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
struct JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::JComparator

Auxiliary class for ordering of objects in the collection by the hash value of their keys.

Definition at line 79 of file JHashMap.hh.

Constructor & Destructor Documentation

◆ JComparator()

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::JComparator::JComparator ( const JEvaluator_t &  evaluator = JEvaluator_t())
inline

Constructor.

Parameters
evaluatorevaluator

Definition at line 86 of file JHashMap.hh.

86  :
87  getValue(evaluator)
88  {}

Member Function Documentation

◆ operator()() [1/2]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
bool JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::JComparator::operator() ( typename JClass< value_type >::argument_type  first,
typename JClass< value_type >::argument_type  second 
) const
inline

Comparison of elements.

Parameters
firstfirst element
secondsecond element
Returns
true if first element less than second element; else false

Definition at line 98 of file JHashMap.hh.

100  {
101  return this->getValue(first.first) < this->getValue(second.first);
102  }

◆ operator()() [2/2]

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
bool JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::JComparator::operator() ( typename JClass< value_type >::argument_type  element,
typename JClass< key_type >::argument_type  x 
) const
inline

Comparison of element and key value.

Parameters
elementelement
xkey value
Returns
true if element less than key value; else false

Definition at line 112 of file JHashMap.hh.

114  {
115  return this->getValue(element.first) < this->getValue(x);
116  }

Member Data Documentation

◆ getValue

template<class JKey_t, class JValue_t, class JEvaluator_t = JHashEvaluator>
JEvaluator_t JTOOLS::JHashMap< JKey_t, JValue_t, JEvaluator_t >::JComparator::getValue

Function object for evaluation of key.

Definition at line 122 of file JHashMap.hh.


The documentation for this struct was generated from the following file:
JTOOLS::JHashMap::JComparator::getValue
JEvaluator_t getValue
Function object for evaluation of key.
Definition: JHashMap.hh:122