#ifndef __JBIND2ND__ #define __JBIND2ND__ #include #include "JTrigger/JMatch.hh" namespace JTRIGGER { /** * Auxiliary class to convert binary JMatch operator and given hit to unary match operator. * * This class is equivalent to the STD binder2nd class but it uses references to the JMatch * interface rather than copies of a derived class. */ template class JBinder2nd : public std::unary_function { public: /** * Constructor. * * \param __match match operator * \param __second second hit */ JBinder2nd(const JMatch& __match, const JHit_t& __second) : match (__match), second(__second) {} /** * Unary match operator. * * \param first first hit * \return true if first and second hit match; else false */ inline bool operator()(const JHit_t& first) const { return match(first, second); } protected: const JMatch& match; const JHit_t& second; }; /** * Auxiliary method to create JBinder2nd object. * * \param match match operator * \param second second hit * \return JBinder2nd */ template inline JBinder2nd JBind2nd(const JMatch& match, const JHit_t& second) { return JBinder2nd(match, second); } } #endif