1 // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*- 2 // 3 // logical_operators__Vector__Vector.h: Rcpp R/C++ interface class library -- 4 // logical operators for Vector to Vector comparisons 5 // 6 // Copyright (C) 2010 - 2011 Dirk Eddelbuettel and Romain Francois 7 // 8 // This file is part of Rcpp. 9 // 10 // Rcpp is free software: you can redistribute it and/or modify it 11 // under the terms of the GNU General Public License as published by 12 // the Free Software Foundation, either version 2 of the License, or 13 // (at your option) any later version. 14 // 15 // Rcpp is distributed in the hope that it will be useful, but 16 // WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 // GNU General Public License for more details. 19 // 20 // You should have received a copy of the GNU General Public License 21 // along with Rcpp. If not, see <http://www.gnu.org/licenses/>. 22 23 #ifndef Rcpp__sugar__logical_operators__Vector__Vector_h 24 #define Rcpp__sugar__logical_operators__Vector__Vector_h 25 26 /* Vector < Vector */ 27 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 28 inline Rcpp::sugar::Comparator< 29 RTYPE , 30 Rcpp::sugar::less<RTYPE>, 31 LHS_NA, LHS_T, 32 RHS_NA, RHS_T 33 > 34 operator<( 35 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 36 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 37 ){ 38 return Rcpp::sugar::Comparator< 39 RTYPE, 40 Rcpp::sugar::less<RTYPE>, 41 LHS_NA, LHS_T, 42 RHS_NA, RHS_T 43 >( 44 lhs, rhs 45 ) ; 46 } 47 /* Vector > Vector */ 48 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 49 inline Rcpp::sugar::Comparator< 50 RTYPE , 51 Rcpp::sugar::greater<RTYPE>, 52 LHS_NA, LHS_T, 53 RHS_NA, RHS_T 54 > 55 operator>( 56 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 57 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 58 ){ 59 return Rcpp::sugar::Comparator< 60 RTYPE, 61 Rcpp::sugar::greater<RTYPE>, 62 LHS_NA, LHS_T, 63 RHS_NA, RHS_T 64 >( 65 lhs, rhs 66 ) ; 67 } 68 /* Vector <= Vector */ 69 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 70 inline Rcpp::sugar::Comparator< 71 RTYPE , 72 Rcpp::sugar::less_or_equal<RTYPE>, 73 LHS_NA, LHS_T, 74 RHS_NA, RHS_T 75 > 76 operator<=( 77 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 78 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 79 ){ 80 return Rcpp::sugar::Comparator< 81 RTYPE, 82 Rcpp::sugar::less_or_equal<RTYPE>, 83 LHS_NA, LHS_T, 84 RHS_NA, RHS_T 85 >( 86 lhs, rhs 87 ) ; 88 } 89 /* Vector >= Vector */ 90 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 91 inline Rcpp::sugar::Comparator< 92 RTYPE , 93 Rcpp::sugar::greater_or_equal<RTYPE>, 94 LHS_NA, LHS_T, 95 RHS_NA, RHS_T 96 > 97 operator>=( 98 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 99 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 100 ){ 101 return Rcpp::sugar::Comparator< 102 RTYPE, 103 Rcpp::sugar::greater_or_equal<RTYPE>, 104 LHS_NA, LHS_T, 105 RHS_NA, RHS_T 106 >( 107 lhs, rhs 108 ) ; 109 } 110 /* Vector == Vector */ 111 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 112 inline Rcpp::sugar::Comparator< 113 RTYPE , 114 Rcpp::sugar::equal<RTYPE>, 115 LHS_NA, LHS_T, 116 RHS_NA, RHS_T 117 > 118 operator==( 119 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 120 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 121 ){ 122 return Rcpp::sugar::Comparator< 123 RTYPE, 124 Rcpp::sugar::equal<RTYPE>, 125 LHS_NA, LHS_T, 126 RHS_NA, RHS_T 127 >( 128 lhs, rhs 129 ) ; 130 } 131 /* Vector != Vector */ 132 template <int RTYPE,bool LHS_NA,typename LHS_T,bool RHS_NA, typename RHS_T> 133 inline Rcpp::sugar::Comparator< 134 RTYPE , 135 Rcpp::sugar::not_equal<RTYPE>, 136 LHS_NA, LHS_T, 137 RHS_NA, RHS_T 138 > 139 operator!=( 140 const Rcpp::VectorBase<RTYPE,LHS_NA,LHS_T>& lhs , 141 const Rcpp::VectorBase<RTYPE,RHS_NA,RHS_T>& rhs 142 ){ 143 return Rcpp::sugar::Comparator< 144 RTYPE, 145 Rcpp::sugar::not_equal<RTYPE>, 146 LHS_NA, LHS_T, 147 RHS_NA, RHS_T 148 >( 149 lhs, rhs 150 ) ; 151 } 152 153 #endif 154