xtd 0.2.0
Loading...
Searching...
No Matches
equator.hpp
Go to the documentation of this file.
1
4#pragma once
5#define __XTD_CORE_INTERNAL__
7#undef __XTD_CORE_INTERNAL__
9
11namespace xtd {
13 namespace collections {
15 namespace generic {
17 namespace helpers {
38 template<class key_t>
39 struct equator {
41
44 using first_argument_type = key_t;
46 using second_argument_type = key_t;
48 using result_type = bool;
50
52
55 equator() = default;
58 explicit equator(const xtd::collections::generic::iequality_comparer<key_t>& comparer) : comparer {&comparer} {}
60
62
70 if (&a == &b) return true;
71 if (comparer) return comparer->equals(a, b);
72 return __polymorphic_equator__<first_argument_type, typename std::is_polymorphic<first_argument_type>::type> {}(a, b);
73 }
74
75
76 private:
78 };
79 }
80 }
81 }
82}
Contains polymorphic_equator struct.
Defines methods to support the comparison of objects for equality.
Definition iequality_comparer.hpp:34
Contains xtd::collections::generic::iequality_comparer <type_t> interface.
@ a
The A key.
Definition console_key.hpp:88
@ b
The B key.
Definition console_key.hpp:90
The xtd::collections::generic::helpers namespace contains helpers for generic collections,...
Definition allocator.hpp:14
The xtd::collections::generic namespace contains interfaces and classes that define generic collectio...
Definition comparer.hpp:16
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
Implements a function object for compare data.
Definition comparer.hpp:32
equator(const xtd::collections::generic::iequality_comparer< key_t > &comparer)
Initializes a new instance of the hasher with specified comparer.
Definition equator.hpp:58
equator()=default
Initializes a new instance of the hasher.
bool result_type
Represents the result type.
Definition equator.hpp:48
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.
Definition equator.hpp:69
key_t first_argument_type
Represents the first argument type.
Definition equator.hpp:44
key_t second_argument_type
Represents the second argument type.
Definition equator.hpp:46