xtd 0.2.0
Loading...
Searching...
No Matches
__equator.h
Go to the documentation of this file.
1
4
5#pragma once
7#if !defined(__XTD_CORE_INTERNAL__)
8#error "Do not include this file: Internal use only"
9#endif
11
12#include "../object"
13#include <functional>
14#include <type_traits>
15
17template<typename key_t, typename bool_t>
18struct __object_equator__ {};
19
20template<typename key_t>
21struct __object_equator__<key_t, std::true_type> {
22 bool operator()(const key_t& a, const key_t& b) const {return xtd::object::equals(a, b);}
23};
24
25template<typename key_t>
26struct __object_equator__<key_t, std::false_type> {
27 bool operator()(const key_t& a, const key_t& b) const {return std::equal_to<key_t> {}(a, b);}
28};
29
30template<typename key_t, typename bool_t>
31struct __polymorphic_equator__ {};
32
33template<typename key_t>
34struct __polymorphic_equator__<key_t, std::true_type> {
35 bool operator()(const key_t& a, const key_t& b) const {return __object_equator__<key_t, typename std::is_base_of<xtd::object, key_t>::type> {}(a, b);}
36};
37
38template<typename key_t>
39struct __polymorphic_equator__<key_t, std::false_type> {
40 bool operator()(const key_t& a, const key_t& b) const {return std::equal_to<key_t> {}(a, b);}
41};
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
@ a
The A key.
@ b
The B key.