Does the C++ standard define an interface for a predicate?
The reason I am asking is that I have an template class (see below) where I would like to accept a predicate as an input to the constructor. How do I specify a predicate as an input argument to the constructor? I have read online that the unary_function<> base class in the standard is not intended to be an interface.
One example I have seen online somewhere is this;Code:template<typename T> Class Myfoo { Myfoo(); ... }
but I dont really need another generic type, I want a more specific type, a predicate.Code:template<typename T, typename Pred> Class Myfoo { Myfoo(Pred p); ... }
Any suggestions?



LinkBack URL
About LinkBacks


