LCOV - code coverage report
Current view: top level - usr/include/c++/6/bits - predefined_ops.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 18 0.0 %
Date: 2018-11-14 16:53:58 Functions: 0 12 0.0 %

          Line data    Source code
       1             : // Default predicates for internal use -*- C++ -*-
       2             : 
       3             : // Copyright (C) 2013-2016 Free Software Foundation, Inc.
       4             : //
       5             : // This file is part of the GNU ISO C++ Library.  This library is free
       6             : // software; you can redistribute it and/or modify it under the
       7             : // terms of the GNU General Public License as published by the
       8             : // Free Software Foundation; either version 3, or (at your option)
       9             : // any later version.
      10             : 
      11             : // This library is distributed in the hope that it will be useful,
      12             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             : // GNU General Public License for more details.
      15             : 
      16             : // Under Section 7 of GPL version 3, you are granted additional
      17             : // permissions described in the GCC Runtime Library Exception, version
      18             : // 3.1, as published by the Free Software Foundation.
      19             : 
      20             : // You should have received a copy of the GNU General Public License and
      21             : // a copy of the GCC Runtime Library Exception along with this program;
      22             : // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      23             : // <http://www.gnu.org/licenses/>.
      24             : 
      25             : /** @file predefined_ops.h
      26             :  *  This is an internal header file, included by other library headers.
      27             :  *  You should not attempt to use it directly. @headername{algorithm}
      28             :  */
      29             : 
      30             : #ifndef _GLIBCXX_PREDEFINED_OPS_H
      31             : #define _GLIBCXX_PREDEFINED_OPS_H       1
      32             : 
      33             : namespace __gnu_cxx
      34             : {
      35             : namespace __ops
      36             : {
      37             :   struct _Iter_less_iter
      38             :   {
      39             :     template<typename _Iterator1, typename _Iterator2>
      40             :       _GLIBCXX14_CONSTEXPR
      41             :       bool
      42             :       operator()(_Iterator1 __it1, _Iterator2 __it2) const
      43             :       { return *__it1 < *__it2; }
      44             :   };
      45             : 
      46             :   _GLIBCXX14_CONSTEXPR
      47             :   inline _Iter_less_iter
      48             :   __iter_less_iter()
      49             :   { return _Iter_less_iter(); }
      50             : 
      51             :   struct _Iter_less_val
      52             :   {
      53             :     template<typename _Iterator, typename _Value>
      54             :       bool
      55             :       operator()(_Iterator __it, _Value& __val) const
      56             :       { return *__it < __val; }
      57             :   };
      58             : 
      59             :   inline _Iter_less_val
      60             :   __iter_less_val()
      61             :   { return _Iter_less_val(); }
      62             : 
      63             :   inline _Iter_less_val
      64             :   __iter_comp_val(_Iter_less_iter)
      65             :   { return _Iter_less_val(); }
      66             : 
      67             :   struct _Val_less_iter
      68             :   {
      69             :     template<typename _Value, typename _Iterator>
      70             :       bool
      71             :       operator()(_Value& __val, _Iterator __it) const
      72             :       { return __val < *__it; }
      73             :   };
      74             : 
      75             :   inline _Val_less_iter
      76             :   __val_less_iter()
      77             :   { return _Val_less_iter(); }
      78             : 
      79             :   inline _Val_less_iter
      80             :   __val_comp_iter(_Iter_less_iter)
      81             :   { return _Val_less_iter(); }
      82             : 
      83             :   struct _Iter_equal_to_iter
      84             :   {
      85             :     template<typename _Iterator1, typename _Iterator2>
      86             :       bool
      87             :       operator()(_Iterator1 __it1, _Iterator2 __it2) const
      88             :       { return *__it1 == *__it2; }
      89             :   };
      90             : 
      91             :   inline _Iter_equal_to_iter
      92             :   __iter_equal_to_iter()
      93             :   { return _Iter_equal_to_iter(); }
      94             : 
      95             :   struct _Iter_equal_to_val
      96             :   {
      97             :     template<typename _Iterator, typename _Value>
      98             :       bool
      99             :       operator()(_Iterator __it, _Value& __val) const
     100             :       { return *__it == __val; }
     101             :   };
     102             : 
     103             :   inline _Iter_equal_to_val
     104             :   __iter_equal_to_val()
     105             :   { return _Iter_equal_to_val(); }
     106             : 
     107             :   inline _Iter_equal_to_val
     108             :   __iter_comp_val(_Iter_equal_to_iter)
     109             :   { return _Iter_equal_to_val(); }
     110             : 
     111             :   template<typename _Compare>
     112             :     struct _Iter_comp_iter
     113             :     {
     114             :       _Compare _M_comp;
     115             : 
     116             :       explicit _GLIBCXX14_CONSTEXPR
     117           0 :       _Iter_comp_iter(_Compare __comp)
     118             :         : _M_comp(__comp)
     119           0 :       { }
     120             : 
     121             :       template<typename _Iterator1, typename _Iterator2>
     122             :         _GLIBCXX14_CONSTEXPR
     123             :         bool
     124           0 :         operator()(_Iterator1 __it1, _Iterator2 __it2)
     125           0 :         { return bool(_M_comp(*__it1, *__it2)); }
     126             :     };
     127             : 
     128             :   template<typename _Compare>
     129             :     _GLIBCXX14_CONSTEXPR
     130             :     inline _Iter_comp_iter<_Compare>
     131           0 :     __iter_comp_iter(_Compare __comp)
     132           0 :     { return _Iter_comp_iter<_Compare>(__comp); }
     133             : 
     134             :   template<typename _Compare>
     135             :     struct _Iter_comp_val
     136             :     {
     137             :       _Compare _M_comp;
     138             : 
     139             :       explicit
     140           0 :       _Iter_comp_val(_Compare __comp)
     141             :         : _M_comp(__comp)
     142           0 :       { }
     143             : 
     144             :       template<typename _Iterator, typename _Value>
     145             :         bool
     146           0 :         operator()(_Iterator __it, _Value& __val)
     147           0 :         { return bool(_M_comp(*__it, __val)); }
     148             :     };
     149             : 
     150             :   template<typename _Compare>
     151             :    inline _Iter_comp_val<_Compare>
     152             :     __iter_comp_val(_Compare __comp)
     153             :     { return _Iter_comp_val<_Compare>(__comp); }
     154             : 
     155             :   template<typename _Compare>
     156             :     inline _Iter_comp_val<_Compare>
     157           0 :     __iter_comp_val(_Iter_comp_iter<_Compare> __comp)
     158           0 :     { return _Iter_comp_val<_Compare>(__comp._M_comp); }
     159             : 
     160             :   template<typename _Compare>
     161             :     struct _Val_comp_iter
     162             :     {
     163             :       _Compare _M_comp;
     164             : 
     165             :       explicit
     166           0 :       _Val_comp_iter(_Compare __comp)
     167             :         : _M_comp(__comp)
     168           0 :       { }
     169             : 
     170             :       template<typename _Value, typename _Iterator>
     171             :         bool
     172           0 :         operator()(_Value& __val, _Iterator __it)
     173           0 :         { return bool(_M_comp(__val, *__it)); }
     174             :     };
     175             : 
     176             :   template<typename _Compare>
     177             :     inline _Val_comp_iter<_Compare>
     178             :     __val_comp_iter(_Compare __comp)
     179             :     { return _Val_comp_iter<_Compare>(__comp); }
     180             : 
     181             :   template<typename _Compare>
     182             :     inline _Val_comp_iter<_Compare>
     183           0 :     __val_comp_iter(_Iter_comp_iter<_Compare> __comp)
     184           0 :     { return _Val_comp_iter<_Compare>(__comp._M_comp); }
     185             : 
     186             :   template<typename _Value>
     187             :     struct _Iter_equals_val
     188             :     {
     189             :       _Value& _M_value;
     190             : 
     191             :       explicit
     192             :       _Iter_equals_val(_Value& __value)
     193             :         : _M_value(__value)
     194             :       { }
     195             : 
     196             :       template<typename _Iterator>
     197             :         bool
     198             :         operator()(_Iterator __it)
     199             :         { return *__it == _M_value; }
     200             :     };
     201             : 
     202             :   template<typename _Value>
     203             :     inline _Iter_equals_val<_Value>
     204             :     __iter_equals_val(_Value& __val)
     205             :     { return _Iter_equals_val<_Value>(__val); }
     206             : 
     207             :   template<typename _Iterator1>
     208             :     struct _Iter_equals_iter
     209             :     {
     210             :       _Iterator1 _M_it1;
     211             : 
     212             :       explicit
     213             :       _Iter_equals_iter(_Iterator1 __it1)
     214             :         : _M_it1(__it1)
     215             :       { }
     216             : 
     217             :       template<typename _Iterator2>
     218             :         bool
     219             :         operator()(_Iterator2 __it2)
     220             :         { return *__it2 == *_M_it1; }
     221             :     };
     222             : 
     223             :   template<typename _Iterator>
     224             :     inline _Iter_equals_iter<_Iterator>
     225             :     __iter_comp_iter(_Iter_equal_to_iter, _Iterator __it)
     226             :     { return _Iter_equals_iter<_Iterator>(__it); }
     227             : 
     228             :   template<typename _Predicate>
     229             :     struct _Iter_pred
     230             :     {
     231             :       _Predicate _M_pred;
     232             : 
     233             :       explicit
     234             :       _Iter_pred(_Predicate __pred)
     235             :         : _M_pred(__pred)
     236             :       { }
     237             : 
     238             :       template<typename _Iterator>
     239             :         bool
     240             :         operator()(_Iterator __it)
     241             :         { return bool(_M_pred(*__it)); }
     242             :     };
     243             : 
     244             :   template<typename _Predicate>
     245             :     inline _Iter_pred<_Predicate>
     246             :     __pred_iter(_Predicate __pred)
     247             :     { return _Iter_pred<_Predicate>(__pred); }
     248             : 
     249             :   template<typename _Compare, typename _Value>
     250             :     struct _Iter_comp_to_val
     251             :     {
     252             :       _Compare _M_comp;
     253             :       _Value& _M_value;
     254             : 
     255             :       _Iter_comp_to_val(_Compare __comp, _Value& __value)
     256             :         : _M_comp(__comp), _M_value(__value)
     257             :       { }
     258             : 
     259             :       template<typename _Iterator>
     260             :         bool
     261             :         operator()(_Iterator __it)
     262             :         { return bool(_M_comp(*__it, _M_value)); }
     263             :     };
     264             : 
     265             :   template<typename _Compare, typename _Value>
     266             :     _Iter_comp_to_val<_Compare, _Value>
     267             :     __iter_comp_val(_Compare __comp, _Value &__val)
     268             :     { return _Iter_comp_to_val<_Compare, _Value>(__comp, __val); }
     269             : 
     270             :   template<typename _Compare, typename _Iterator1>
     271             :     struct _Iter_comp_to_iter
     272             :     {
     273             :       _Compare _M_comp;
     274             :       _Iterator1 _M_it1;
     275             : 
     276             :       _Iter_comp_to_iter(_Compare __comp, _Iterator1 __it1)
     277             :         : _M_comp(__comp), _M_it1(__it1)
     278             :       { }
     279             : 
     280             :       template<typename _Iterator2>
     281             :         bool
     282             :         operator()(_Iterator2 __it2)
     283             :         { return bool(_M_comp(*__it2, *_M_it1)); }
     284             :     };
     285             : 
     286             :   template<typename _Compare, typename _Iterator>
     287             :     inline _Iter_comp_to_iter<_Compare, _Iterator>
     288             :     __iter_comp_iter(_Iter_comp_iter<_Compare> __comp, _Iterator __it)
     289             :     { return _Iter_comp_to_iter<_Compare, _Iterator>(__comp._M_comp, __it); }
     290             : 
     291             :   template<typename _Predicate>
     292             :     struct _Iter_negate
     293             :     {
     294             :       _Predicate _M_pred;
     295             : 
     296             :       explicit
     297             :       _Iter_negate(_Predicate __pred)
     298             :         : _M_pred(__pred)
     299             :       { }
     300             : 
     301             :       template<typename _Iterator>
     302             :         bool
     303             :         operator()(_Iterator __it)
     304             :         { return !bool(_M_pred(*__it)); }
     305             :     };
     306             : 
     307             :   template<typename _Predicate>
     308             :     inline _Iter_negate<_Predicate>
     309             :     __negate(_Iter_pred<_Predicate> __pred)
     310             :     { return _Iter_negate<_Predicate>(__pred._M_pred); }
     311             : 
     312             : } // namespace __ops
     313             : } // namespace __gnu_cxx
     314             : 
     315             : #endif

Generated by: LCOV version 1.13