lin
operators.hpp
Go to the documentation of this file.
1 
5 #ifndef LIN_QUERIES_OPERATORS_HPP_
6 #define LIN_QUERIES_OPERATORS_HPP_
7 
8 #include "../core.hpp"
9 #include "operations.hpp"
10 
11 #include <type_traits>
12 
13 namespace lin {
14 namespace internal {
15 
16 template <class C, class D, std::enable_if_t<
17  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
18 inline constexpr auto operator==(internal::Stream<C> const &c, internal::Stream<D> const &d) {
19  return lin::equal_to(c, d);
20 }
21 
22 template <typename T, class C, std::enable_if_t<
23  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
24 inline constexpr auto operator==(T const &t, internal::Stream<C> const &c) {
25  return lin::equal_to(t, c);
26 }
27 
28 template <class C, typename T, std::enable_if_t<
29  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
30 inline constexpr auto operator==(internal::Stream<C> const &c, T const &t) {
31  return lin::equal_to(c, t);
32 }
33 
34 template <class C, class D, std::enable_if_t<
35  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
36 inline constexpr auto operator>(internal::Stream<C> const &c, internal::Stream<D> const &d) {
37  return lin::greater(c, d);
38 }
39 
40 template <typename T, class C, std::enable_if_t<
41  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
42 inline constexpr auto operator>(T const &t, internal::Stream<C> const &c) {
43  return lin::greater(t, c);
44 }
45 
46 template <class C, typename T, std::enable_if_t<
47  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
48 inline constexpr auto operator>(internal::Stream<C> const &c, T const &t) {
49  return lin::greater(c, t);
50 }
51 
52 template <class C, class D, std::enable_if_t<
53  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
54 inline constexpr auto operator>=(internal::Stream<C> const &c, internal::Stream<D> const &d) {
55  return lin::greater_equal(c, d);
56 }
57 
58 template <typename T, class C, std::enable_if_t<
59  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
60 inline constexpr auto operator>=(T const &t, internal::Stream<C> const &c) {
61  return lin::greater_equal(t, c);
62 }
63 
64 template <class C, typename T, std::enable_if_t<
65  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
66 inline constexpr auto operator>=(internal::Stream<C> const &c, T const &t) {
67  return lin::greater_equal(c, t);
68 }
69 
70 template <class C, class D, std::enable_if_t<
71  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
72 inline constexpr auto operator<(internal::Stream<C> const &c, internal::Stream<D> const &d) {
73  return lin::less(c, d);
74 }
75 
76 template <typename T, class C, std::enable_if_t<
77  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
78 inline constexpr auto operator<(T const &t, internal::Stream<C> const &c) {
79  return lin::less(t, c);
80 }
81 
82 template <class C, typename T, std::enable_if_t<
83  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
84 inline constexpr auto operator<(internal::Stream<C> const &c, T const &t) {
85  return lin::less(c, t);
86 }
87 
88 template <class C, class D, std::enable_if_t<
89  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
90 inline constexpr auto operator<=(internal::Stream<C> const &c, internal::Stream<D> const &d) {
91  return lin::less_equal(c, d);
92 }
93 
94 template <typename T, class C, std::enable_if_t<
95  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
96 inline constexpr auto operator<=(T const &t, internal::Stream<C> const &c) {
97  return lin::less_equal(t, c);
98 }
99 
100 template <class C, typename T, std::enable_if_t<
101  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
102 inline constexpr auto operator<=(internal::Stream<C> const &c, T const &t) {
103  return lin::less_equal(c, t);
104 }
105 
106 template <class C, class D, std::enable_if_t<
107  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
108 inline constexpr auto operator&&(internal::Stream<C> const &c, internal::Stream<D> const &d) {
109  return lin::logical_and(c, d);
110 }
111 
112 template <typename T, class C, std::enable_if_t<
113  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
114 inline constexpr auto operator&&(T const &t, internal::Stream<C> const &c) {
115  return lin::logical_and(t, c);
116 }
117 
118 template <class C, typename T, std::enable_if_t<
119  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
120 inline constexpr auto operator&&(internal::Stream<C> const &c, T const &t) {
121  return lin::logical_and(c, t);
122 }
123 
124 template <class C, std::enable_if_t<internal::matches_tensor<C>::value, size_t> = 0>
125 inline constexpr auto operator!(internal::Stream<C> const &c) {
126  return lin::logical_not(c);
127 }
128 
129 template <class C, class D, std::enable_if_t<
130  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
131 inline constexpr auto operator||(internal::Stream<C> const &c, internal::Stream<D> const &d) {
132  return lin::logical_or(c, d);
133 }
134 
135 template <typename T, class C, std::enable_if_t<
136  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
137 inline constexpr auto operator||(T const &t, internal::Stream<C> const &c) {
138  return lin::logical_or(t, c);
139 }
140 
141 template <class C, typename T, std::enable_if_t<
142  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
143 inline constexpr auto operator||(internal::Stream<C> const &c, T const &t) {
144  return lin::logical_or(c, t);
145 }
146 
147 template <class C, class D, std::enable_if_t<
148  internal::matches_tensor_tensor<C, D>::value, size_t> = 0>
149 inline constexpr auto operator!=(internal::Stream<C> const &c, internal::Stream<D> const &d) {
150  return lin::not_equal_to(c, d);
151 }
152 
153 template <typename T, class C, std::enable_if_t<
154  internal::matches_scalar_tensor<T, C>::value, size_t> = 0>
155 inline constexpr auto operator!=(T const &t, internal::Stream<C> const &c) {
156  return lin::not_equal_to(t, c);
157 }
158 
159 template <class C, typename T, std::enable_if_t<
160  internal::matches_tensor_scalar<C, T>::value, size_t> = 0>
161 inline constexpr auto operator!=(internal::Stream<C> const &c, T const &t) {
162  return lin::not_equal_to(c, t);
163 }
164 } // namespace internal
165 } // namespace lin
166 
167 #endif
Definition: config.hpp:27