diff --git a/include/maxscale/session_command.hh b/include/maxscale/session_command.hh index 956e4f0ca..b18f076ea 100644 --- a/include/maxscale/session_command.hh +++ b/include/maxscale/session_command.hh @@ -89,22 +89,6 @@ public: */ bool eq(const SessionCommand& rhs) const; - class Equals: public std::unary_function - { - public: - Equals(const SSessionCommand& base): - m_base(base) - {} - - bool operator ()(const SSessionCommand& rhs) - { - return m_base->eq(*rhs); - } - - private: - const SSessionCommand& m_base; - }; - private: mxs::Buffer m_buffer; /**< The buffer containing the command */ uint8_t m_command; /**< The command being executed */ diff --git a/include/maxscale/utils.hh b/include/maxscale/utils.hh index 9dafe95f7..022d4af8f 100644 --- a/include/maxscale/utils.hh +++ b/include/maxscale/utils.hh @@ -268,4 +268,31 @@ private: ContainerType m_registry; }; +// binary compare of pointed-to objects +template +bool equal_pointees(const Ptr& lhs, const Ptr& rhs) +{ + return *lhs == *rhs; +} + +// Unary predicate for equality of pointed-to objects +template +class EqualPointees +{ +public: + EqualPointees(const T& lhs) : m_ppLhs(&lhs) {} + bool operator()(const T& pRhs) + { + return **m_ppLhs == *pRhs; + } +private: + const T* m_ppLhs; +}; + +template +EqualPointees equal_pointees(const T& t) +{ + return EqualPointees(t); +} + }