OpenWalnut  1.5.0dev
Public Member Functions | List of all members
WPredicateHelper::ArbitraryPredicateBase< T > Class Template Referenceabstract

This class builds the base for wrapping around nearly every possible predicates like functors, classes with operator() and so on. More...

#include <WPredicateHelper.h>

+ Inheritance diagram for WPredicateHelper::ArbitraryPredicateBase< T >:

Public Member Functions

 ArbitraryPredicateBase ()
 Creates instance. More...
 
virtual ~ArbitraryPredicateBase ()
 Destructor. More...
 
virtual bool operator() (T const &inst) const =0
 Checks the instance of T against an arbitrary predicate. More...
 

Detailed Description

template<typename T>
class WPredicateHelper::ArbitraryPredicateBase< T >

This class builds the base for wrapping around nearly every possible predicates like functors, classes with operator() and so on.

It is especially useful to have an base class allowing predicate evaluation without knowing the exact predicate type. In multi-threaded environments, command queues are a common way to add/remove/replace items in a list. With this base class it is possible to provide predicates in such queues. The direct use of this class for std algorithms (find_if, remove_if, count_if, ... ) is not recommended as it simply is not needed.

Template Parameters
thetype to evaluate the predicate for. Usually, this is the type of list elements.

Definition at line 150 of file WPredicateHelper.h.

Constructor & Destructor Documentation

◆ ArbitraryPredicateBase()

template<typename T >
WPredicateHelper::ArbitraryPredicateBase< T >::ArbitraryPredicateBase ( )
inline

Creates instance.

Definition at line 156 of file WPredicateHelper.h.

◆ ~ArbitraryPredicateBase()

template<typename T >
virtual WPredicateHelper::ArbitraryPredicateBase< T >::~ArbitraryPredicateBase ( )
inlinevirtual

Destructor.

Definition at line 163 of file WPredicateHelper.h.

Member Function Documentation

◆ operator()()

template<typename T >
virtual bool WPredicateHelper::ArbitraryPredicateBase< T >::operator() ( T const &  inst) const
pure virtual

Checks the instance of T against an arbitrary predicate.

Parameters
instthe value to check against a predicate
Returns
true if predicate evaluates to true

Implemented in WPredicateHelper::ArbitraryPredicate< T, Predicate >.


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