xtd 0.2.0
Loading...
Searching...
No Matches
xtd::collections::generic::comparer< type_t > Class Template Reference
Inheritance diagram for xtd::collections::generic::comparer< type_t >:
xtd::object xtd::collections::generic::icomparer< type_t > xtd::interface

Definition

template<class type_t>
class xtd::collections::generic::comparer< type_t >

Provides a base class for implementations of the xtd::collections::generic::icomparer <type_t> generic interface.

Definition
template<class type_t>
Provides a base class for implementations of the xtd::collections::generic::icomparer <type_t> generi...
Definition comparer.hpp:33
Exposes a method that compares two objects.
Definition icomparer.hpp:30
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:44
Header
#include <xtd/collections/generic/comparer>
Namespace
xtd::collections::generic
Library
xtd.core
Examples
generic_icollection.cpp, and generic_ilist.cpp.

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 = int32
 Represents the result type.
 

Public Properties

static const comparer< type_t > default_comparer
 Returns a default sort order comparer for the type specified by the generic argument.
 

Public Methods

result_type compare (const first_argument_type &x, const second_argument_type &y) const noexcept override
 Compares two entities and returns a value indicating whether one is less than, equal to, or greater than the other.
 

Protected Constructors

 comparer ()=default
 Initializes a new instance of the xtd::collections::generic::comparer <type_t> class.
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual xtd::size get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<class object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
virtual xtd::string to_string () const noexcept
 Returns a xtd::string that represents the current object.
 
virtual int32 compare (const type_t &x, const type_t &y) const =0
 Compares two entities and returns a value indicating whether one is less than, equal to, or greater than the other.
 
- Static Public Member Functions inherited from xtd::object
template<class object_a_t , class object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<class object_a_t , class object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Typedef Documentation

◆ first_argument_type

template<class type_t >
using xtd::collections::generic::comparer< type_t >::first_argument_type = type_t

Represents the first argument type.

◆ second_argument_type

template<class type_t >
using xtd::collections::generic::comparer< type_t >::second_argument_type = type_t

Represents the second argument type.

◆ result_type

template<class type_t >
using xtd::collections::generic::comparer< type_t >::result_type = int32

Represents the result type.

Constructor & Destructor Documentation

◆ comparer()

template<class type_t >
xtd::collections::generic::comparer< type_t >::comparer ( )
protecteddefault

Initializes a new instance of the xtd::collections::generic::comparer <type_t> class.

Member Function Documentation

◆ compare()

template<class type_t >
result_type xtd::collections::generic::comparer< type_t >::compare ( const first_argument_type x,
const second_argument_type y 
) const
inlineoverridevirtualnoexcept

Compares two entities and returns a value indicating whether one is less than, equal to, or greater than the other.

Parameters
xThe first entity to compare.
yThe second entity to compare.
Returns
A 32-bit signed integer that indicates the relative order of the entities being compared. The return value has these meanings:
Value Condition
Less than zero x is less than y.
Zero x equals y.
Greater than zero x is greater than y.

Implements xtd::collections::generic::icomparer< type_t >.

Member Data Documentation

◆ default_comparer

template<class type_t >
const comparer<type_t> xtd::collections::generic::comparer< type_t >::default_comparer
static

Returns a default sort order comparer for the type specified by the generic argument.


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