Asposecpplib
System::Collections::Generic::ComparerAdapter< T > Struct Template Reference

Adapter to use IComparer within STL environment. Uses IComparer if set; otherwise, uses operator < (if available) or returns false (if not). More...

Public Member Functions

 ComparerAdapter ()
 Constructs adapter without any comparator available. More...
 
 ComparerAdapter (const SharedPtr< System::Collections::Generic::IComparer< T > > &comparator)
 Constructs adapter. More...
 
void set_Comparator (const SharedPtr< IComparer< T > > &comparator)
 Sets comparator object. More...
 
template<typename Q = T>
std::enable_if< detail::has_operator_less< Q >::value, bool >::type operator() (const Q &x, const Q &y) const
 Comparison function for types with operator < available. More...
 
template<typename Q = T>
std::enable_if<!detail::has_operator_less< Q >::value, bool >::type operator() (const Q &x, const Q &y) const
 Comparison function for types with operator < not available. More...
 

Detailed Description

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

Adapter to use IComparer within STL environment. Uses IComparer if set; otherwise, uses operator < (if available) or returns false (if not).

Template Parameters
TType being compared.

Constructor & Destructor Documentation

◆ ComparerAdapter() [1/2]

Constructs adapter without any comparator available.

◆ ComparerAdapter() [2/2]

Constructs adapter.

Parameters
comparatorComparator object to use.

Member Function Documentation

◆ operator()() [1/2]

template<class T >
template<typename Q = T>
std::enable_if<detail::has_operator_less<Q>::value, bool>::type System::Collections::Generic::ComparerAdapter< T >::operator() ( const Q &  x,
const Q &  y 
) const
inline

Comparison function for types with operator < available.

Template Parameters
QType being compared; template for type conversion availability.
Parameters
xFirst value to compare.
ySecond value to compare.
Returns
True if x is considered less than y, false otherwise.

◆ operator()() [2/2]

template<class T >
template<typename Q = T>
std::enable_if<!detail::has_operator_less<Q>::value, bool>::type System::Collections::Generic::ComparerAdapter< T >::operator() ( const Q &  x,
const Q &  y 
) const
inline

Comparison function for types with operator < not available.

Template Parameters
QType being compared; template for type conversion availability.
Parameters
xFirst value to compare.
ySecond value to compare.
Returns
True if comparator is set and x is considered less than y, false otherwise.

◆ set_Comparator()

template<class T >
void System::Collections::Generic::ComparerAdapter< T >::set_Comparator ( const SharedPtr< IComparer< T > > &  comparator)
inline

Sets comparator object.

Parameters
comparatorComparator to use.