xtd 0.2.0
Loading...
Searching...
No Matches
lesser.hpp
Go to the documentation of this file.
1
4#pragma once
5#define __XTD_CORE_INTERNAL__
7#undef __XTD_CORE_INTERNAL__
8#include "../icomparer.hpp"
9
11namespace xtd {
13 namespace collections {
15 namespace generic {
17 namespace helpers {
38 template<class type_t = void>
39 struct lesser {
41
44 using first_argument_type = type_t;
46 using second_argument_type = type_t;
48 using result_type = bool;
50
52
55 lesser() = default;
60
62
68 constexpr auto operator()(const first_argument_type& lhs, const second_argument_type& rhs) const -> result_type {
69 if (comparer_) return comparer_->compare(lhs, rhs) < 0;
70 return __polymorphic_lesser__<first_argument_type, typename std::is_polymorphic<first_argument_type>::type> {}(lhs, rhs);
71 }
72
73
74 private:
75 const xtd::collections::generic::icomparer<type_t>* comparer_ = nullptr;
76 };
77 }
78 }
79 }
80}
Contains polymorphic_lesser struct.
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Contains xtd::collections::generic::icomparer <type_t> interface.
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
type_t first_argument_type
Represents the first argument type.
Definition lesser.hpp:44
type_t second_argument_type
Represents the second argument type.
Definition lesser.hpp:46
bool result_type
Represents the result type.
Definition lesser.hpp:48
lesser()=default
Initializes a new instance of the comparer.
constexpr auto operator()(const first_argument_type &lhs, const second_argument_type &rhs) const -> result_type
Serves as a hash function for a specified key with a particular type (type_t).
Definition lesser.hpp:68
lesser(const xtd::collections::generic::icomparer< type_t > &comparer)
Initializes a new instance of the comparer with specified comparer.
Definition lesser.hpp:58