5 #ifndef LIN_QUERIES_OPERATIONS_HPP_ 6 #define LIN_QUERIES_OPERATIONS_HPP_ 11 #include <type_traits> 16 std::enable_if_t<internal::matches_tensor<C>::value,
size_t> = 0>
17 constexpr
bool all(internal::Stream<C>
const &c) {
18 for (
size_t i = 0; i < c.size(); i++)
if (!c(i))
return false;
23 std::enable_if_t<internal::matches_scalar<T>::value,
size_t> = 0>
24 constexpr
bool all(T
const &t) {
29 constexpr
bool any(internal::Stream<C>
const &c) {
30 for (
size_t i = 0; i < c.size(); i++)
if (c(i))
return true;
35 std::enable_if_t<internal::matches_scalar<T>::value,
size_t> = 0>
36 constexpr
bool any(T
const &t) {
40 template <
class C,
class D, std::enable_if_t<
41 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
42 inline constexpr
auto equal_to(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
46 return internal::StreamElementWiseOperator<internal::equal_to, C, D>(c, d);
49 template <
typename T,
class C, std::enable_if_t<
50 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
51 inline constexpr
auto equal_to(T
const &t, internal::Stream<C>
const &c) {
52 return internal::StreamElementWiseOperator<internal::equal_to_st<T>, C>(c, t);
55 template <
class C,
typename T, std::enable_if_t<
56 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
57 inline constexpr
auto equal_to(internal::Stream<C>
const &c, T
const &t) {
58 return internal::StreamElementWiseOperator<internal::equal_to_ts<T>, C>(c, t);
61 template <
typename T,
typename U, std::enable_if_t<
62 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
63 inline constexpr
auto equal_to(T
const &t, U
const &u) {
64 return internal::equal_to()(t, u);
67 template <
class C,
class D, std::enable_if_t<
68 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
69 inline constexpr
auto greater(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
73 return internal::StreamElementWiseOperator<internal::greater, C, D>(c, d);
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 greater(T
const &t, internal::Stream<C>
const &c) {
79 return internal::StreamElementWiseOperator<internal::greater_st<T>, C>(c, t);
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 greater(internal::Stream<C>
const &c, T
const &t) {
85 return internal::StreamElementWiseOperator<internal::greater_ts<T>, C>(c, t);
88 template <
typename T,
typename U, std::enable_if_t<
89 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
90 inline constexpr
auto greater(T
const &t, U
const &u) {
91 return internal::greater()(t, u);
94 template <
class C,
class D, std::enable_if_t<
95 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
96 inline constexpr
auto greater_equal(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
100 return internal::StreamElementWiseOperator<internal::greater_equal, C, D>(c, d);
103 template <
typename T,
class C, std::enable_if_t<
104 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
105 inline constexpr
auto greater_equal(T
const &t, internal::Stream<C>
const &c) {
106 return internal::StreamElementWiseOperator<internal::greater_equal_st<T>, C>(c, t);
109 template <
class C,
typename T, std::enable_if_t<
110 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
111 inline constexpr
auto greater_equal(internal::Stream<C>
const &c, T
const &t) {
112 return internal::StreamElementWiseOperator<internal::greater_equal_ts<T>, C>(c, t);
115 template <
typename T,
typename U, std::enable_if_t<
116 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
117 inline constexpr
auto greater_equal(T
const &t, U
const &u) {
118 return internal::greater_equal()(t, u);
121 template <
class C,
class D, std::enable_if_t<
122 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
123 inline constexpr
auto less(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
127 return internal::StreamElementWiseOperator<internal::less, C, D>(c, d);
130 template <
typename T,
class C, std::enable_if_t<
131 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
132 inline constexpr
auto less(T
const &t, internal::Stream<C>
const &c) {
133 return internal::StreamElementWiseOperator<internal::less_st<T>, C>(c, t);
136 template <
class C,
typename T, std::enable_if_t<
137 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
138 inline constexpr
auto less(internal::Stream<C>
const &c, T
const &t) {
139 return internal::StreamElementWiseOperator<internal::less_ts<T>, C>(c, t);
142 template <
typename T,
typename U, std::enable_if_t<
143 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
144 inline constexpr
auto less(T
const &t, U
const &u) {
145 return internal::less()(t, u);
148 template <
class C,
class D, std::enable_if_t<
149 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
150 inline constexpr
auto less_equal(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
154 return internal::StreamElementWiseOperator<internal::less_equal, C, D>(c, d);
157 template <
typename T,
class C, std::enable_if_t<
158 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
159 inline constexpr
auto less_equal(T
const &t, internal::Stream<C>
const &c) {
160 return internal::StreamElementWiseOperator<internal::less_equal_st<T>, C>(c, t);
163 template <
class C,
typename T, std::enable_if_t<
164 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
165 inline constexpr
auto less_equal(internal::Stream<C>
const &c, T
const &t) {
166 return internal::StreamElementWiseOperator<internal::less_equal_ts<T>, C>(c, t);
169 template <
typename T,
typename U, std::enable_if_t<
170 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
171 inline constexpr
auto less_equal(T
const &t, U
const &u) {
172 return internal::less_equal()(t, u);
175 template <
class C,
class D, std::enable_if_t<
176 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
177 inline constexpr
auto logical_and(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
181 return internal::StreamElementWiseOperator<internal::logical_and, C, D>(c, d);
184 template <
typename T,
class C, std::enable_if_t<
185 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
186 inline constexpr
auto logical_and(T
const &t, internal::Stream<C>
const &c) {
187 return internal::StreamElementWiseOperator<internal::logical_and_st<T>, C>(c, t);
190 template <
class C,
typename T, std::enable_if_t<
191 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
192 inline constexpr
auto logical_and(internal::Stream<C>
const &c, T
const &t) {
193 return internal::StreamElementWiseOperator<internal::logical_and_ts<T>, C>(c, t);
196 template <
typename T,
typename U, std::enable_if_t<
197 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
198 inline constexpr
auto logical_and(T
const &t, U
const &u) {
199 return internal::logical_and()(t, u);
202 template <class C, std::enable_if_t<internal::matches_tensor<C>::value,
size_t> = 0>
203 inline constexpr
auto logical_not(internal::Stream<C>
const &c) {
204 return internal::StreamElementWiseOperator<internal::logical_not, C>(c);
207 template <typename T, std::enable_if_t<internal::matches_scalar<T>::value,
size_t> = 0>
208 inline constexpr
auto logical_not(T
const &t) {
209 return internal::logical_not()(t);
212 template <
class C,
class D, std::enable_if_t<
213 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
214 inline constexpr
auto logical_or(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
218 return internal::StreamElementWiseOperator<internal::logical_or, C, D>(c, d);
221 template <
typename T,
class C, std::enable_if_t<
222 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
223 inline constexpr
auto logical_or(T
const &t, internal::Stream<C>
const &c) {
224 return internal::StreamElementWiseOperator<internal::logical_or_st<T>, C>(c, t);
227 template <
class C,
typename T, std::enable_if_t<
228 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
229 inline constexpr
auto logical_or(internal::Stream<C>
const &c, T
const &t) {
230 return internal::StreamElementWiseOperator<internal::logical_or_ts<T>, C>(c, t);
233 template <
typename T,
typename U, std::enable_if_t<
234 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
235 inline constexpr
auto logical_or(T
const &t, U
const &u) {
236 return internal::logical_or()(t, u);
239 template <
class C,
class D, std::enable_if_t<
240 internal::matches_tensor_tensor<C, D>::value,
size_t> = 0>
241 inline constexpr
auto not_equal_to(internal::Stream<C>
const &c, internal::Stream<D>
const &d) {
245 return internal::StreamElementWiseOperator<internal::not_equal_to, C, D>(c, d);
248 template <
typename T,
class C, std::enable_if_t<
249 internal::matches_scalar_tensor<T, C>::value,
size_t> = 0>
250 inline constexpr
auto not_equal_to(T
const &t, internal::Stream<C>
const &c) {
251 return internal::StreamElementWiseOperator<internal::not_equal_to_st<T>, C>(c, t);
254 template <
class C,
typename T, std::enable_if_t<
255 internal::matches_tensor_scalar<C, T>::value,
size_t> = 0>
256 inline constexpr
auto not_equal_to(internal::Stream<C>
const &c, T
const &t) {
257 return internal::StreamElementWiseOperator<internal::not_equal_to_ts<T>, C>(c, t);
260 template <
typename T,
typename U, std::enable_if_t<
261 internal::matches_scalar_scalar<T, U>::value,
size_t> = 0>
262 inline constexpr
auto not_equal_to(T
const &t, U
const &u) {
263 return internal::not_equal_to()(t, u);
#define LIN_ASSERT(x)
Asserts the condition x when assertions are enabled within lin.
Definition: config.hpp:22
Definition: config.hpp:27