DotNetDupe 4.0.6
C++17/20 Implementation of the .NET Base Class Library (BCL)
Loading...
Searching...
No Matches
DotNetDupe::System::Predicate< T > Class Template Reference

Represents the method that defines a set of criteria and determines whether the specified object meets those criteria. More...

#include <Predicate.h>

Public Member Functions

 Predicate ()
 Initializes an empty instance of the Predicate class.
 Predicate (decltype(nullptr))
 Initializes an empty instance from a null pointer.
template<typename F, typename = std::enable_if_t<!std::is_same_v<std::decay_t<F>, Predicate> && std::is_invocable_r_v<bool, std::decay_t<F>, T>>>
 Predicate (F &&func)
 Constructs a Predicate delegate from a callable object or lambda.
bool Invoke (T obj) const
 Evaluates the predicate criteria against the provided object.
 operator bool () const
 Checks if the predicate encapsulates a non-null target callable.
bool operator() (T obj) const
 Function call operator forwarding to Invoke().

Detailed Description

template<typename T>
class DotNetDupe::System::Predicate< T >

Represents the method that defines a set of criteria and determines whether the specified object meets those criteria.

Template Parameters
TThe type of the object to compare.
Note
Thread Safety: Safe for concurrent invocation if the encapsulated function object is reentrant. Standard Citation: ECMA-335 CLI Common Language Infrastructure.

Definition at line 19 of file Predicate.h.

Constructor & Destructor Documentation

◆ Predicate() [1/3]

template<typename T>
DotNetDupe::System::Predicate< T >::Predicate ( )
inline

Initializes an empty instance of the Predicate class.

Definition at line 22 of file Predicate.h.

◆ Predicate() [2/3]

template<typename T>
DotNetDupe::System::Predicate< T >::Predicate ( decltype(nullptr) )
inline

Initializes an empty instance from a null pointer.

Definition at line 25 of file Predicate.h.

◆ Predicate() [3/3]

template<typename T>
template<typename F, typename = std::enable_if_t<!std::is_same_v<std::decay_t<F>, Predicate> && std::is_invocable_r_v<bool, std::decay_t<F>, T>>>
DotNetDupe::System::Predicate< T >::Predicate ( F && func)
inline

Constructs a Predicate delegate from a callable object or lambda.

Template Parameters
FThe invocable type.
Parameters
funcThe callable object evaluating criteria on an instance of T.

Definition at line 31 of file Predicate.h.

Member Function Documentation

◆ Invoke()

template<typename T>
bool DotNetDupe::System::Predicate< T >::Invoke ( T obj) const
inline

Evaluates the predicate criteria against the provided object.

Parameters
objThe target object to evaluate.
Returns
True if the object matches the criteria, false otherwise.

Definition at line 36 of file Predicate.h.

Referenced by operator()().

◆ operator bool()

template<typename T>
DotNetDupe::System::Predicate< T >::operator bool ( ) const
inlineexplicit

Checks if the predicate encapsulates a non-null target callable.

Returns
True if non-null, false otherwise.

Definition at line 49 of file Predicate.h.

◆ operator()()

template<typename T>
bool DotNetDupe::System::Predicate< T >::operator() ( T obj) const
inline

Function call operator forwarding to Invoke().

Parameters
objThe target object to evaluate.
Returns
True if the object matches the criteria, false otherwise.

Definition at line 43 of file Predicate.h.

References Invoke().


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