System::Collections::Generic::EqualityComparerAdapter< T > Struct Template Reference

Public Member Functions

 EqualityComparerAdapter ()
 Creates adapter not using any comparator. More...
 
 EqualityComparerAdapter (const SharedPtr< IEqualityComparer< T >> &comparator)
 
void set_EqualityComparator (const SharedPtr< IEqualityComparer< T >> &comparator)
 
bool operator() (const T &x, const T &y) const
 

Detailed Description

template<class T>
struct System::Collections::Generic::EqualityComparerAdapter< T >

Adapter making it possible using IEqualityComparer with STL-styled collections and algorithms. Uses IEqualityComparer, if set. If not set, uses operator ==, Object::Equals or T::Equals, whichever is available.

Template Parameters
TType being compared.

Constructor & Destructor Documentation

◆ EqualityComparerAdapter() [1/2]

Creates adapter not using any comparator.

◆ EqualityComparerAdapter() [2/2]

template<class T >
System::Collections::Generic::EqualityComparerAdapter< T >::EqualityComparerAdapter ( const SharedPtr< IEqualityComparer< T >> &  comparator)
inline

Creates adapter with given comparator.

Parameters
comparatorComparator to use.

Member Function Documentation

◆ operator()()

template<class T >
bool System::Collections::Generic::EqualityComparerAdapter< T >::operator() ( const T &  x,
const T &  y 
) const
inline

Compares two objects.

Parameters
xLHS operand.
yRHS operand.
Returns
True if operands are considered equal, false otherwise.

◆ set_EqualityComparator()

template<class T >
void System::Collections::Generic::EqualityComparerAdapter< T >::set_EqualityComparator ( const SharedPtr< IEqualityComparer< T >> &  comparator)
inline

Sets comparator.

Parameters
comparatorComparator to use.