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

Definition

template<class type_t = void>
struct xtd::collections::generic::helpers::lesser< type_t >

Implements a function object for compare data.

struct lesser;
Implements a function object for compare data.
Definition lesser.hpp:38
Header
#include <xtd/collections/generic/helpers/lesser>
Namespace
xtd::collections::generic::helpers
Library
xtd.core
Remarks
The associative containers xtd::collections::generic::sorted_set, xtd::collections::generic::sorted_multi_set, xtd::collections::generic::sorted_dictionary, xtd::collections::generic::sorted_multi_dictionary use specializations of the template xtd::collections::generic::helpers::lesser as the defaultcompare function.
Examples
The following example show how to use xtd::collections::generic::helpers::lesser with std::unordered_map.
auto key_values = std::map<xtd::date_time, xtd::string, xtd::collections::generic::helpers::lesser<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

Public Aliases

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

Public Operators

constexpr result_type operator() (const first_argument_type &lhs, const second_argument_type &rhs) const
 Serves as a hash function for a specified key with a particular type (type_t).
 

Member Typedef Documentation

◆ first_argument_type

template<class type_t = void>
using xtd::collections::generic::helpers::lesser< type_t >::first_argument_type = type_t

Represents the first argument type.

◆ second_argument_type

template<class type_t = void>
using xtd::collections::generic::helpers::lesser< type_t >::second_argument_type = type_t

Represents the second argument type.

◆ result_type

template<class type_t = void>
using xtd::collections::generic::helpers::lesser< type_t >::result_type = bool

Represents the result type.

Member Function Documentation

◆ operator()()

template<class type_t = void>
constexpr result_type xtd::collections::generic::helpers::lesser< type_t >::operator() ( const first_argument_type lhs,
const second_argument_type rhs 
) const
inlineconstexpr

Serves as a hash function for a specified key with a particular type (type_t).

Parameters
keyThe key to hash.
Returns
A hash code for the spesified key.
Remarks
If key_t inherits from xtd::object, the xtd::object::get_hash_code method will be used; otherwise, the std::hash object function will be used.

The documentation for this struct was generated from the following file: