xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::helpers::equator< key_t > Struct Template Reference

Definition

template<class key_t>
struct xtd::collections::generic::helpers::equator< key_t >

Implements a function object for performing comparisons. Unless specialised, invokes operator== on type type_t. xtd::equator with the key and the value strongly typed to be xtd::any_object.

template<class key_t>
struct equator;
equator()=default
Initializes a new instance of the hasher.
Header
#include <xtd/collections/generic/helpers/equator>
Namespace
xtd::collections::generic::helpers
Library
xtd.core
Examples
The following example show how to use xtd::collections::generic::helpers::equator with std::unordered_map.
auto key_values = std::unordered_map<xtd::date_time, xtd::string, xtd::collections::generic::helpers::hasher<xtd::date_time>, xtd::collections::generic::helpers::equator<xtd::date_time>, xtd::collections::generic::helpers::allocator<xtd::collections::generic::key_value_pair<const xtd::date_time, xtd::string>>> {};
key_values.insert({{1971, 1, 5}, "Birth date"});
std::allocator< type_t > allocator
Represent an allocator alias.
Definition allocator.hpp:38
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:39

Public Aliases

using first_argument_type
 Represents the first argument type.
 
using second_argument_type
 Represents the second argument type.
 
using result_type
 Represents the result type.
 

Public Constructors

 equator ()=default
 Initializes a new instance of the hasher.
 
 equator (const xtd::collections::generic::iequality_comparer< key_t > &comparer)
 Initializes a new instance of the hasher with specified comparer.
 

Public Operators

auto operator() (const first_argument_type &a, const second_argument_type &b) const -> result_type
 checks if the specified a and b keys are equal.
 

Member Typedef Documentation

◆ first_argument_type

template<class key_t>
using xtd::collections::generic::helpers::equator< key_t >::first_argument_type

Represents the first argument type.

◆ second_argument_type

template<class key_t>
using xtd::collections::generic::helpers::equator< key_t >::second_argument_type

Represents the second argument type.

◆ result_type

template<class key_t>
using xtd::collections::generic::helpers::equator< key_t >::result_type

Represents the result type.

Constructor & Destructor Documentation

◆ equator() [1/2]

template<class key_t>
xtd::collections::generic::helpers::equator< key_t >::equator ( )
default

Initializes a new instance of the hasher.

◆ equator() [2/2]

template<class key_t>
xtd::collections::generic::helpers::equator< key_t >::equator ( const xtd::collections::generic::iequality_comparer< key_t > & comparer)
inlineexplicit

Initializes a new instance of the hasher with specified comparer.

Parameters
comparerA comparer used to hash the key.

Member Function Documentation

◆ operator()()

template<class key_t>
auto xtd::collections::generic::helpers::equator< key_t >::operator() ( const first_argument_type & a,
const second_argument_type & b ) const -> result_type
inline

checks if the specified a and b keys are equal.

Parameters
aThe first key to check.
bThe second key to check.
Returns
true if keys are equals; otherwise false.
Remarks
If key_t inherits from xtd::object, the xtd::object::equals method will be used; otherwise, the std::equal_to object function will be used.

The documentation for this struct was generated from the following file:
  • xtd.core/include/xtd/collections/generic/helpers/equator.hpp