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

Definition

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

Implements a function object for compare data.

struct lesser;
lesser()=default
Initializes a new instance of the comparer.
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::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
 Represents the first argument type.
 
using second_argument_type
 Represents the second argument type.
 
using result_type
 Represents the result type.
 

Public Constructors

 lesser ()=default
 Initializes a new instance of the comparer.
 
 lesser (const xtd::collections::generic::icomparer< value_t > &comparer)
 Initializes a new instance of the comparer with specified comparer.
 

Public Operators

constexpr auto operator() (const first_argument_type &x, const second_argument_type &y) const -> result_type
 Compares two entities and returns a value indicating whether one is less than the other.
 

Member Typedef Documentation

◆ first_argument_type

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

Represents the first argument type.

◆ second_argument_type

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

Represents the second argument type.

◆ result_type

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

Represents the result type.

Constructor & Destructor Documentation

◆ lesser() [1/2]

template<class value_t = void>
xtd::collections::generic::helpers::lesser< value_t >::lesser ( )
default

Initializes a new instance of the comparer.

◆ lesser() [2/2]

template<class value_t = void>
xtd::collections::generic::helpers::lesser< value_t >::lesser ( const xtd::collections::generic::icomparer< value_t > & comparer)
inlineexplicit

Initializes a new instance of the comparer with specified comparer.

Parameters
comparerA comparer used to hash the key.

Member Function Documentation

◆ operator()()

template<class value_t = void>
auto xtd::collections::generic::helpers::lesser< value_t >::operator() ( const first_argument_type & x,
const second_argument_type & y ) const -> result_type
inlineconstexpr

Compares two entities and returns a value indicating whether one is less than the other.

Parameters
xThe first entity to compare.
yThe second entity to compare.
Returns
true is x less than y; otherwise false.

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