////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2015-2016. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/move for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_MOVE_ALGO_PREDICATE_HPP #define BOOST_MOVE_ALGO_PREDICATE_HPP #include #include #include #include #include #include namespace boost { namespace movelib { template struct antistable { inline explicit antistable(Comp &comp) : m_comp(comp) {} inline antistable(const antistable & other) : m_comp(other.m_comp) {} template inline bool operator()(const U &u, const V & v) { return !m_comp(v, u); } inline const Comp &get() const { return m_comp; } private: antistable & operator=(const antistable &); Comp &m_comp; }; template Comp unantistable(Comp comp) { return comp; } template Comp unantistable(antistable comp) { return comp.get(); } template class negate { public: inline negate() {} inline explicit negate(Comp comp) : m_comp(comp) {} template inline bool operator()(const T1& l, const T2& r) { return !m_comp(l, r); } private: Comp m_comp; }; template class inverse { public: inline inverse() {} inline explicit inverse(Comp comp) : m_comp(comp) {} template inline bool operator()(const T1& l, const T2& r) { return m_comp(r, l); } private: Comp m_comp; }; } //namespace movelib { } //namespace boost { #endif //#define BOOST_MOVE_ALGO_PREDICATE_HPP