| 11 | /// parameters being given should never be nullptr. |
| 12 | template<typename _PARAM> |
| 13 | class BestFilter |
| 14 | { |
| 15 | private: |
| 16 | std::function<_PARAM(_PARAM,_PARAM)> pred; |
| 17 | public: |
| 18 | // Constructor |
| 19 | template <typename _T> |
| 20 | BestFilter(const _T &predicate) : pred(predicate) |
| 21 | {}; |
| 22 | |
| 23 | // Assignment |
| 24 | template <typename _T> |
| 25 | BestFilter<_PARAM> &operator =(const _T &other) |
| 26 | { |
| 27 | this->pred = other; |
| 28 | return *this; |
| 29 | }; |
| 30 | |
| 31 | // Bitwise operators |
| 32 | template <typename _T> |
| 33 | inline BestFilter<_PARAM> operator &&(const _T &other) const |
| 34 | { |
| 35 | return [=](_PARAM p1, _PARAM p2)->_PARAM{ return other( (*this)(p1, p2) ); }; |
| 36 | }; |
| 37 | |
| 38 | // call |
| 39 | inline _PARAM operator()(const _PARAM &p1, const _PARAM &p2) const |
| 40 | { |
| 41 | return this->pred(p1, p2); |
| 42 | }; |
| 43 | |
| 44 | }; |
| 45 | |
| 46 | template <typename _PARAM> |
| 47 | BestFilter<_PARAM> Lowest(const CompareFilter<_PARAM,int> &filter) |
nothing calls this directly
no outgoing calls
no test coverage detected