Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:40:52

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2015-2016.
0004 // Distributed under the Boost Software License, Version 1.0.
0005 // (See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt)
0007 //
0008 // See http://www.boost.org/libs/move for documentation.
0009 //
0010 //////////////////////////////////////////////////////////////////////////////
0011 #ifndef BOOST_MOVE_ALGO_PREDICATE_HPP
0012 #define BOOST_MOVE_ALGO_PREDICATE_HPP
0013 
0014 #include <boost/move/algo/move.hpp>
0015 #include <boost/move/adl_move_swap.hpp>
0016 #include <boost/move/algo/detail/basic_op.hpp>
0017 #include <boost/move/detail/iterator_traits.hpp>
0018 #include <boost/move/detail/destruct_n.hpp>
0019 #include <cassert>
0020 
0021 namespace boost {
0022 namespace movelib {
0023 
0024 template<class Comp>
0025 struct antistable
0026 {
0027    BOOST_MOVE_FORCEINLINE explicit antistable(Comp &comp)
0028       : m_comp(comp)
0029    {}
0030 
0031    BOOST_MOVE_FORCEINLINE antistable(const antistable & other)
0032       : m_comp(other.m_comp)
0033    {}
0034 
0035    template<class U, class V>
0036    BOOST_MOVE_FORCEINLINE bool operator()(const U &u, const V & v)
0037    {  return !m_comp(v, u);  }
0038 
0039    BOOST_MOVE_FORCEINLINE const Comp &get() const
0040    {  return m_comp; }
0041 
0042    private:
0043    antistable & operator=(const antistable &);
0044    Comp &m_comp;
0045 };
0046 
0047 template<class Comp>
0048 Comp unantistable(Comp comp)
0049 {   return comp;  }
0050 
0051 template<class Comp>
0052 Comp unantistable(antistable<Comp> comp)
0053 {   return comp.get();  }
0054 
0055 template <class Comp>
0056 class negate
0057 {
0058    public:
0059    BOOST_MOVE_FORCEINLINE negate()
0060    {}
0061 
0062    BOOST_MOVE_FORCEINLINE explicit negate(Comp comp)
0063       : m_comp(comp)
0064    {}
0065 
0066    template <class T1, class T2>
0067    BOOST_MOVE_FORCEINLINE bool operator()(const T1& l, const T2& r)
0068    {
0069       return !m_comp(l, r);
0070    }
0071 
0072    private:
0073    Comp m_comp;
0074 };
0075 
0076 
0077 template <class Comp>
0078 class inverse
0079 {
0080    public:
0081    BOOST_MOVE_FORCEINLINE inverse()
0082    {}
0083 
0084    BOOST_MOVE_FORCEINLINE explicit inverse(Comp comp)
0085       : m_comp(comp)
0086    {}
0087 
0088    template <class T1, class T2>
0089    BOOST_MOVE_FORCEINLINE bool operator()(const T1& l, const T2& r)
0090    {
0091       return m_comp(r, l);
0092    }
0093 
0094    private:
0095    Comp m_comp;
0096 };
0097 
0098 }  //namespace movelib {
0099 }  //namespace boost {
0100 
0101 #endif   //#define BOOST_MOVE_ALGO_PREDICATE_HPP