cartodata 6.0.0
functional.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34#ifndef CARTODATA_VOLUME_FUNCTIONAL_H
35#define CARTODATA_VOLUME_FUNCTIONAL_H
36
37#include <cartobase/type/types.h>
38#include <cartobase/type/datatypetraits.h>
39#include <exception>
40#include <functional>
41#include <limits>
42
43 // Reimplements std functional with more flexibility on left and right
44 // operands types.
45
46namespace carto {
47namespace volumeutil {
48
49 //==========================================================================
50 // Arithmetic return type detectors
51 //==========================================================================
52
53 // With builtin types, arithmetic operations are performed in the most
54 // precise type possible with a combination of integer promotion,
55 // signness and floating point conversion.
56 // The following structures automatically detect the preferred output
57 // type.
58 // However, with volume, we often want to store the result in a datatype
59 // similar to the input type. To counter the effects of integer promotion,
60 // these structures are then specialized for 8b and 16b types.
61 //
62 // Implicit conversion mechanisms are nicely explained here:
63 // https://www.safaribooksonline.com/library/view/c-in-a/0596006977/ch04.html
64
65 // plus
66
67 template <typename LEFT, typename RIGHT>
69 {
70#if __cplusplus >= 201100
71 typedef decltype( std::declval<LEFT>() + std::declval<RIGHT>() )
72 result_type;
73#else
74 typedef typeof( LEFT() + RIGHT() ) result_type;
75#endif
76 };
77
78 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
79 struct plus_result<CONTAINER<LEFT>, RIGHT>
80 {
81 typedef CONTAINER<typename plus_result<LEFT,RIGHT>::result_type>
83 };
84
85 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
86 struct plus_result<LEFT, CONTAINER<RIGHT> >
87 {
88 typedef CONTAINER<typename plus_result<LEFT,RIGHT>::result_type>
90 };
91
92 template <typename LEFT, typename RIGHT,
93 template<typename> class CONTAINER1,
94 template <typename> class CONTAINER2>
95 struct plus_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
96 {
97 typedef CONTAINER1<typename plus_result<LEFT,RIGHT>::result_type>
99 };
100
101 // minus
102
103 template <typename LEFT, typename RIGHT>
105 {
106#if __cplusplus >= 201100
107 typedef decltype( std::declval<LEFT>() - std::declval<RIGHT>() )
108 result_type;
109#else
110 typedef typeof( LEFT() - RIGHT() ) result_type;
111#endif
112 };
113
114 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
115 struct minus_result<CONTAINER<LEFT>, RIGHT>
116 {
117 typedef CONTAINER<typename minus_result<LEFT,RIGHT>::result_type>
119 };
120
121 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
122 struct minus_result<LEFT, CONTAINER<RIGHT> >
123 {
124 typedef CONTAINER<typename minus_result<LEFT,RIGHT>::result_type>
126 };
127
128 template <typename LEFT, typename RIGHT,
129 template<typename> class CONTAINER1,
130 template <typename> class CONTAINER2>
131 struct minus_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
132 {
133 typedef CONTAINER1<typename minus_result<LEFT,RIGHT>::result_type>
135 };
136
137 // multiplies
138
139 template <typename LEFT, typename RIGHT>
141 {
142#if __cplusplus >= 201100
143 typedef decltype( std::declval<LEFT>() * std::declval<RIGHT>() )
144 result_type;
145#else
146 typedef typeof( LEFT() * RIGHT() ) result_type;
147#endif
148 };
149
150 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
151 struct multiplies_result<CONTAINER<LEFT>, RIGHT>
152 {
153 typedef CONTAINER<typename multiplies_result<LEFT,RIGHT>::result_type>
155 };
156
157 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
158 struct multiplies_result<LEFT, CONTAINER<RIGHT> >
159 {
160 typedef CONTAINER<typename multiplies_result<LEFT,RIGHT>::result_type>
162 };
163
164 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER1, template <typename> class CONTAINER2>
165 struct multiplies_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
166 {
167 typedef CONTAINER1<typename multiplies_result<LEFT,RIGHT>::result_type>
169 };
170
171 // divides
172
173 template <typename LEFT, typename RIGHT>
175 {
176#if __cplusplus >= 201100
177 typedef decltype( std::declval<LEFT>() / std::declval<RIGHT>() )
178 result_type;
179#else
180 typedef typeof( LEFT() / RIGHT() ) result_type;
181#endif
182 };
183
184 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
185 struct divides_result<CONTAINER<LEFT>, RIGHT>
186 {
187 typedef CONTAINER<typename divides_result<LEFT,RIGHT>::result_type>
189 };
190
191 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
192 struct divides_result<LEFT, CONTAINER<RIGHT> >
193 {
194 typedef CONTAINER<typename divides_result<LEFT,RIGHT>::result_type>
196 };
197
198 template <typename LEFT, typename RIGHT,
199 template<typename> class CONTAINER1,
200 template <typename> class CONTAINER2>
201 struct divides_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
202 {
203 typedef CONTAINER1<typename divides_result<LEFT,RIGHT>::result_type>
205 };
206
207 // modulus
208
209 template <typename LEFT, typename RIGHT>
211 {
212#if __cplusplus >= 201100
213 typedef decltype( std::declval<LEFT>() % std::declval<RIGHT>() )
214 result_type;
215#else
216 typedef typeof( LEFT() % RIGHT() ) result_type;
217#endif
218 };
219
220 template <typename LEFT, typename RIGHT,
221 template<typename> class CONTAINER >
222 struct modulus_result<CONTAINER<LEFT>, RIGHT>
223 {
224 typedef CONTAINER<typename modulus_result<LEFT,RIGHT>::result_type>
226 };
227
228 template <typename LEFT, typename RIGHT,
229 template<typename> class CONTAINER >
230 struct modulus_result<LEFT, CONTAINER<RIGHT> >
231 {
232 typedef CONTAINER<typename modulus_result<LEFT,RIGHT>::result_type>
234 };
235
236 template <typename LEFT, typename RIGHT,
237 template<typename> class CONTAINER1,
238 template <typename> class CONTAINER2>
239 struct modulus_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
240 {
241 typedef CONTAINER1<typename modulus_result<LEFT,RIGHT>::result_type>
243 };
244
245 // bitwise_and
246
247 template <typename LEFT, typename RIGHT>
249 {
250#if __cplusplus >= 201100
251 typedef decltype( std::declval<LEFT>() & std::declval<RIGHT>() )
252 result_type;
253#else
254 typedef typeof( LEFT() & RIGHT() ) result_type;
255#endif
256 };
257
258 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
259 struct bitwise_and_result<CONTAINER<LEFT>, RIGHT>
260 {
261 typedef CONTAINER<typename bitwise_and_result<LEFT,RIGHT>::result_type>
263 };
264
265 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
266 struct bitwise_and_result<LEFT, CONTAINER<RIGHT> >
267 {
268 typedef CONTAINER<typename bitwise_and_result<LEFT,RIGHT>::result_type>
270 };
271
272 template <typename LEFT, typename RIGHT,
273 template<typename> class CONTAINER1,
274 template <typename> class CONTAINER2>
275 struct bitwise_and_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
276 {
277 typedef CONTAINER1<typename bitwise_and_result<LEFT,RIGHT>::result_type>
279 };
280
281 // bitwise_or
282
283 template <typename LEFT, typename RIGHT>
285 {
286#if __cplusplus >= 201100
287 typedef decltype( std::declval<LEFT>() | std::declval<RIGHT>() )
288 result_type;
289#else
290 typedef typeof( LEFT() | RIGHT() ) result_type;
291#endif
292 };
293
294 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
295 struct bitwise_or_result<CONTAINER<LEFT>, RIGHT>
296 {
297 typedef CONTAINER<typename bitwise_or_result<LEFT,RIGHT>::result_type>
299 };
300
301 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
302 struct bitwise_or_result<LEFT, CONTAINER<RIGHT> >
303 {
304 typedef CONTAINER<typename bitwise_or_result<LEFT,RIGHT>::result_type>
306 };
307
308 template <typename LEFT, typename RIGHT,
309 template<typename> class CONTAINER1,
310 template <typename> class CONTAINER2>
311 struct bitwise_or_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
312 {
313 typedef CONTAINER1<typename bitwise_or_result<LEFT,RIGHT>::result_type>
315 };
316
317 // bitwise_xor
318
319 template <typename LEFT, typename RIGHT>
321 {
322#if __cplusplus >= 201100
323 typedef decltype( std::declval<LEFT>() ^ std::declval<RIGHT>() )
324 result_type;
325#else
326 typedef typeof( LEFT() ^ RIGHT() ) result_type;
327#endif
328 };
329
330 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
331 struct bitwise_xor_result<CONTAINER<LEFT>, RIGHT>
332 {
333 typedef CONTAINER<typename bitwise_xor_result<LEFT,RIGHT>::result_type>
335 };
336
337 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
338 struct bitwise_xor_result<LEFT, CONTAINER<RIGHT> >
339 {
340 typedef CONTAINER<typename bitwise_xor_result<LEFT,RIGHT>::result_type>
342 };
343
344 template <typename LEFT, typename RIGHT,
345 template<typename> class CONTAINER1,
346 template <typename> class CONTAINER2>
347 struct bitwise_xor_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
348 {
349 typedef CONTAINER1<typename bitwise_xor_result<LEFT,RIGHT>::result_type>
351 };
352
353 // select
354
355 template <typename LEFT, typename RIGHT>
357 {
358#if __cplusplus >= 201100
359 typedef decltype( true ? std::declval<LEFT>() : std::declval<RIGHT>() )
360 ref_result_type;
361 typedef typename std::remove_reference<ref_result_type>::type result_type;
362#else
363 typedef typeof( true ? LEFT() : RIGHT() ) result_type;
364#endif
365 };
366
367 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
368 struct select_result<CONTAINER<LEFT>, RIGHT>
369 {
370 typedef CONTAINER<typename select_result<LEFT,RIGHT>::result_type>
372 };
373
374 template <typename LEFT, typename RIGHT, template<typename> class CONTAINER >
375 struct select_result<LEFT, CONTAINER<RIGHT> >
376 {
377 typedef CONTAINER<typename select_result<LEFT,RIGHT>::result_type>
379 };
380
381 template <typename LEFT, typename RIGHT,
382 template<typename> class CONTAINER1,
383 template <typename> class CONTAINER2>
384 struct select_result<CONTAINER1<LEFT>, CONTAINER2<RIGHT> >
385 {
386 typedef CONTAINER1<typename select_result<LEFT,RIGHT>::result_type>
388 };
389
390 //==========================================================================
391 // Builtin type specialization to take into account integer promotion
392 //==========================================================================
393
394 // helper structure that actual *_result structures will inherit from.
395
396 template <typename LEFT, typename RIGHT>
398
399 template <>
400 struct basic_type_result<uint8_t, uint8_t> { typedef uint8_t result_type; };
401 template <>
402 struct basic_type_result<uint8_t, int8_t> { typedef uint8_t result_type; };
403 template <>
404 struct basic_type_result<uint8_t, uint16_t>
405 { typedef uint16_t result_type; };
406 template <>
407 struct basic_type_result<uint8_t, int16_t> { typedef int16_t result_type; };
408
409 template <>
410 struct basic_type_result<int8_t, uint8_t> { typedef uint8_t result_type; };
411 template <>
412 struct basic_type_result<int8_t, int8_t> { typedef int8_t result_type; };
413 template <>
414 struct basic_type_result<int8_t, uint16_t> { typedef uint16_t result_type; };
415 template <>
416 struct basic_type_result<int8_t, int16_t> { typedef int16_t result_type; };
417
418 template <>
419 struct basic_type_result<uint16_t, uint8_t>
420 { typedef uint16_t result_type; };
421 template <>
422 struct basic_type_result<uint16_t, int8_t> { typedef uint16_t result_type; };
423 template <>
424 struct basic_type_result<uint16_t, uint16_t>
425 { typedef uint16_t result_type; };
426 template <>
427 struct basic_type_result<uint16_t, int16_t>
428 { typedef uint16_t result_type; };
429
430 template <>
431 struct basic_type_result<int16_t, uint8_t> { typedef int16_t result_type; };
432 template <>
433 struct basic_type_result<int16_t, int8_t> { typedef int16_t result_type; };
434 template <>
435 struct basic_type_result<int16_t, uint16_t>
436 { typedef uint16_t result_type; };
437 template <>
438 struct basic_type_result<int16_t, int16_t> { typedef int16_t result_type; };
439
440 // plus
441
442 template <>
443 struct plus_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
444 template <>
445 struct plus_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
446 template <>
447 struct plus_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
448 template <>
449 struct plus_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
450 template <>
451 struct plus_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
452 template <>
453 struct plus_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
454 template <>
455 struct plus_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
456 template <>
457 struct plus_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
458 template <>
459 struct plus_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
460 template <>
461 struct plus_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
462 template <>
463 struct plus_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
464 template <>
465 struct plus_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
466 template <>
467 struct plus_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
468 template <>
469 struct plus_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
470 template <>
471 struct plus_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
472 template <>
473 struct plus_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
474
475 // minus
476
477 template <>
478 struct minus_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
479 template <>
480 struct minus_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
481 template <>
482 struct minus_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
483 template <>
484 struct minus_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
485 template <>
486 struct minus_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
487 template <>
488 struct minus_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
489 template <>
490 struct minus_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
491 template <>
492 struct minus_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
493 template <>
494 struct minus_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
495 template <>
496 struct minus_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
497 template <>
498 struct minus_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
499 template <>
500 struct minus_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
501 template <>
502 struct minus_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
503 template <>
504 struct minus_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
505 template <>
506 struct minus_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
507 template <>
508 struct minus_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
509
510 // multiplies
511
512 template <>
513 struct multiplies_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
514 template <>
515 struct multiplies_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
516 template <>
517 struct multiplies_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
518 template <>
519 struct multiplies_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
520 template <>
521 struct multiplies_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
522 template <>
523 struct multiplies_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
524 template <>
525 struct multiplies_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
526 template <>
527 struct multiplies_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
528 template <>
529 struct multiplies_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
530 template <>
531 struct multiplies_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
532 template <>
533 struct multiplies_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
534 template <>
535 struct multiplies_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
536 template <>
537 struct multiplies_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
538 template <>
539 struct multiplies_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
540 template <>
541 struct multiplies_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
542 template <>
543 struct multiplies_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
544
545 // divides
546
547 template <>
548 struct divides_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
549 template <>
550 struct divides_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
551 template <>
552 struct divides_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
553 template <>
554 struct divides_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
555 template <>
556 struct divides_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
557 template <>
558 struct divides_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
559 template <>
560 struct divides_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
561 template <>
562 struct divides_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
563 template <>
564 struct divides_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
565 template <>
566 struct divides_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
567 template <>
568 struct divides_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
569 template <>
570 struct divides_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
571 template <>
572 struct divides_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
573 template <>
574 struct divides_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
575 template <>
576 struct divides_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
577 template <>
578 struct divides_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
579
580 // modulus
581
582 template <>
583 struct modulus_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
584 template <>
585 struct modulus_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
586 template <>
587 struct modulus_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
588 template <>
589 struct modulus_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
590 template <>
591 struct modulus_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
592 template <>
593 struct modulus_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
594 template <>
595 struct modulus_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
596 template <>
597 struct modulus_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
598 template <>
599 struct modulus_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
600 template <>
601 struct modulus_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
602 template <>
603 struct modulus_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
604 template <>
605 struct modulus_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
606 template <>
607 struct modulus_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
608 template <>
609 struct modulus_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
610 template <>
611 struct modulus_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
612 template <>
613 struct modulus_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
614
615 // bitwise_and
616
617 template <>
618 struct bitwise_and_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
619 template <>
620 struct bitwise_and_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
621 template <>
622 struct bitwise_and_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
623 template <>
624 struct bitwise_and_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
625 template <>
626 struct bitwise_and_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
627 template <>
628 struct bitwise_and_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
629 template <>
630 struct bitwise_and_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
631 template <>
632 struct bitwise_and_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
633 template <>
634 struct bitwise_and_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
635 template <>
636 struct bitwise_and_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
637 template <>
638 struct bitwise_and_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
639 template <>
640 struct bitwise_and_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
641 template <>
642 struct bitwise_and_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
643 template <>
644 struct bitwise_and_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
645 template <>
646 struct bitwise_and_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
647 template <>
648 struct bitwise_and_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
649
650 // bitwise_or
651
652 template <>
653 struct bitwise_or_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
654 template <>
655 struct bitwise_or_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
656 template <>
657 struct bitwise_or_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
658 template <>
659 struct bitwise_or_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
660 template <>
661 struct bitwise_or_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
662 template <>
663 struct bitwise_or_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
664 template <>
665 struct bitwise_or_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
666 template <>
667 struct bitwise_or_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
668 template <>
669 struct bitwise_or_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
670 template <>
671 struct bitwise_or_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
672 template <>
673 struct bitwise_or_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
674 template <>
675 struct bitwise_or_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
676 template <>
677 struct bitwise_or_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
678 template <>
679 struct bitwise_or_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
680 template <>
681 struct bitwise_or_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
682 template <>
683 struct bitwise_or_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
684
685 // bitwise_xor
686
687 template <>
688 struct bitwise_xor_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
689 template <>
690 struct bitwise_xor_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
691 template <>
692 struct bitwise_xor_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
693 template <>
694 struct bitwise_xor_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
695 template <>
696 struct bitwise_xor_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
697 template <>
698 struct bitwise_xor_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
699 template <>
700 struct bitwise_xor_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
701 template <>
702 struct bitwise_xor_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
703 template <>
704 struct bitwise_xor_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
705 template <>
706 struct bitwise_xor_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
707 template <>
708 struct bitwise_xor_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
709 template <>
710 struct bitwise_xor_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
711 template <>
712 struct bitwise_xor_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
713 template <>
714 struct bitwise_xor_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
715 template <>
716 struct bitwise_xor_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
717 template <>
718 struct bitwise_xor_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
719
720 // select
721
722 template <>
723 struct select_result<uint8_t, uint8_t>: public basic_type_result<uint8_t, uint8_t> {};
724 template <>
725 struct select_result<uint8_t, int8_t>: public basic_type_result<uint8_t, int8_t> {};
726 template <>
727 struct select_result<uint8_t, uint16_t>: public basic_type_result<uint8_t, uint16_t> {};
728 template <>
729 struct select_result<uint8_t, int16_t>: public basic_type_result<uint8_t, int16_t> {};
730 template <>
731 struct select_result<int8_t, uint8_t>: public basic_type_result<int8_t, uint8_t> {};
732 template <>
733 struct select_result<int8_t, int8_t>: public basic_type_result<int8_t, int8_t> {};
734 template <>
735 struct select_result<int8_t, uint16_t>: public basic_type_result<int8_t, uint16_t> {};
736 template <>
737 struct select_result<int8_t, int16_t>: public basic_type_result<int8_t, int16_t> {};
738 template <>
739 struct select_result<uint16_t, uint8_t>: public basic_type_result<uint16_t, uint8_t> {};
740 template <>
741 struct select_result<uint16_t, int8_t>: public basic_type_result<uint16_t, int8_t> {};
742 template <>
743 struct select_result<uint16_t, uint16_t>: public basic_type_result<uint16_t, uint16_t> {};
744 template <>
745 struct select_result<uint16_t, int16_t>: public basic_type_result<uint16_t, int16_t> {};
746 template <>
747 struct select_result<int16_t, uint8_t>: public basic_type_result<int16_t, uint8_t> {};
748 template <>
749 struct select_result<int16_t, int8_t>: public basic_type_result<int16_t, int8_t> {};
750 template <>
751 struct select_result<int16_t, uint16_t>: public basic_type_result<int16_t, uint16_t> {};
752 template <>
753 struct select_result<int16_t, int16_t>: public basic_type_result<int16_t, int16_t> {};
754
755 //==========================================================================
756 // Generic operators
757 //==========================================================================
758
759 // Function objects similar to those of the standard library, with the
760 // difference that left and right operand types can differ.
761 // These function objects are then used to perform basic operations
762 // between containers (volumes).
763
764 template <typename LEFT, typename RIGHT = LEFT>
765 struct select_left: public std::binary_function<LEFT, RIGHT, LEFT>
766 {
767 const LEFT & operator() ( const LEFT & x, const RIGHT & ) const
768 {
769 return x;
770 }
771 };
772
773 template <typename LEFT, typename RIGHT = LEFT>
774 struct select_right: public std::binary_function<LEFT, RIGHT, RIGHT>
775 {
776 const RIGHT & operator() ( const LEFT & , const RIGHT & y ) const
777 {
778 return y;
779 }
780 };
781
782 template <typename T>
783 struct identity: public std::unary_function<T, T>
784 {
785 const T & operator() ( const T & x ) const
786 {
787 return x;
788 }
789 };
790
791 template <typename LEFT, typename RIGHT = LEFT>
792 struct plus: public std::binary_function<LEFT, RIGHT, typename plus_result<LEFT,RIGHT>::result_type>
793 {
795 operator() (const LEFT & x, const RIGHT & y) const
796 {
797 return x + y;
798 }
799 };
800
801 template <typename LEFT, typename RIGHT = LEFT>
802 struct minus: public std::binary_function<LEFT, RIGHT, typename minus_result<LEFT,RIGHT>::result_type>
803 {
805 operator() (const LEFT & x, const RIGHT & y) const
806 {
807 return x - y;
808 }
809 };
810
811 template <typename LEFT, typename RIGHT = LEFT>
812 struct multiplies: public std::binary_function<LEFT, RIGHT, typename multiplies_result<LEFT,RIGHT>::result_type>
813 {
815 operator() (const LEFT & x, const RIGHT & y) const
816 {
817 return x * y;
818 }
819 };
820
821 template <typename LEFT, typename RIGHT = LEFT>
822 struct divides: public std::binary_function<LEFT, RIGHT, typename divides_result<LEFT,RIGHT>::result_type>
823 {
825 operator() (const LEFT & x, const RIGHT & y) const
826 {
827 return x / y;
828 }
829 };
830
831 template <typename LEFT, typename RIGHT = LEFT>
832 struct modulus: public std::binary_function<LEFT, RIGHT, typename modulus_result<LEFT,RIGHT>::result_type>
833 {
835 operator() (const LEFT & x, const RIGHT & y) const
836 {
837 return x % y;
838 }
839 };
840
841 template <typename T>
842 struct negate: public std::unary_function<T, T>
843 {
844 T operator() (const T & x) const
845 {
846 return -x;
847 }
848 };
849
850 template <typename T>
851 struct increment: public std::unary_function<T, T>
852 {
853 T operator() (T x) const
854 {
855 return ++x;
856 }
857 };
858
859 template <typename T>
860 struct decrement: public std::unary_function<T, T>
861 {
862 T operator() (T x) const
863 {
864 return --x;
865 }
866 };
867
868 template <typename LEFT, typename RIGHT = LEFT>
869 struct equal_to: public std::binary_function<LEFT, RIGHT, bool>
870 {
871 bool operator() (const LEFT & x, const RIGHT & y) const
872 {
873 return x == y;
874 }
875 };
876
877 template <typename LEFT, typename RIGHT = LEFT>
878 struct not_equal_to: public std::binary_function<LEFT, RIGHT, bool>
879 {
880 bool operator() (const LEFT & x, const RIGHT & y) const
881 {
882 return x != y;
883 }
884 };
885
886 template <typename LEFT, typename RIGHT = LEFT>
887 struct greater: public std::binary_function<LEFT, RIGHT, bool>
888 {
889 bool operator() (const LEFT & x, const RIGHT & y) const
890 {
891 return x > y;
892 }
893 };
894
895 template <typename LEFT, typename RIGHT = LEFT>
896 struct less: public std::binary_function<LEFT, RIGHT, bool>
897 {
898 bool operator() (const LEFT & x, const RIGHT & y) const
899 {
900 return x < y;
901 }
902 };
903
904 template <typename LEFT, typename RIGHT = LEFT>
905 struct greater_equal: public std::binary_function<LEFT, RIGHT, bool>
906 {
907 bool operator() (const LEFT & x, const RIGHT & y) const
908 {
909 return x >= y;
910 }
911 };
912
913 template <typename LEFT, typename RIGHT = LEFT>
914 struct less_equal: public std::binary_function<LEFT, RIGHT, bool>
915 {
916 bool operator() (const LEFT & x, const RIGHT & y) const
917 {
918 return x <= y;
919 }
920 };
921
922 template <typename LEFT, typename RIGHT = LEFT>
923 struct logical_and: public std::binary_function<LEFT, RIGHT, bool>
924 {
925 bool operator() (const LEFT & x, const RIGHT & y) const
926 {
927 return x && y;
928 }
929 };
930
931 template <typename LEFT, typename RIGHT = LEFT>
932 struct logical_or: public std::binary_function<LEFT, RIGHT, bool>
933 {
934 bool operator() (const LEFT & x, const RIGHT & y) const
935 {
936 return x || y;
937 }
938 };
939
940 template <typename T>
941 struct logical_not: public std::unary_function<T, bool>
942 {
943 bool operator() (const T & x) const
944 {
945 return !x;
946 }
947 };
948
949 template <typename LEFT, typename RIGHT = LEFT>
950 struct bitwise_and: public std::binary_function<LEFT, RIGHT, typename bitwise_and_result<LEFT,RIGHT>::result_type>
951 {
953 operator() (const LEFT & x, const RIGHT & y) const
954 {
955 return x & y;
956 }
957 };
958
959 template <typename LEFT, typename RIGHT = LEFT>
960 struct bitwise_or: public std::binary_function<LEFT, RIGHT, typename bitwise_or_result<LEFT,RIGHT>::result_type>
961 {
963 operator() (const LEFT & x, const RIGHT & y) const
964 {
965 return x | y;
966 }
967 };
968
969 template <typename LEFT, typename RIGHT = LEFT>
970 struct bitwise_xor: public std::binary_function<LEFT, RIGHT, typename bitwise_xor_result<LEFT,RIGHT>::result_type>
971 {
973 operator() (const LEFT & x, const RIGHT & y) const
974 {
975 return x ^ y;
976 }
977 };
978
979 template <typename T>
980 struct bitwise_not: public std::unary_function<T, T>
981 {
982 T operator() (const T & x) const
983 {
984 return ~x;
985 }
986 };
987
988 template <typename LEFT, typename RIGHT = LEFT>
989 struct bitwise_left_shift: public std::binary_function<LEFT, RIGHT, LEFT>
990 {
991 LEFT operator() (const LEFT & x, const RIGHT & y) const
992 {
993 return x << y;
994 }
995 };
996
997 template <typename LEFT, typename RIGHT = LEFT>
998 struct bitwise_right_shift: public std::binary_function<LEFT, RIGHT, LEFT>
999 {
1000 LEFT operator() (const LEFT & x, const RIGHT & y) const
1001 {
1002 return x >> y;
1003 }
1004 };
1005
1006 template <typename LEFT, typename RIGHT = LEFT>
1007 struct select_min: public std::binary_function<LEFT, RIGHT, typename select_result<LEFT,RIGHT>::result_type>
1008 {
1010 operator() (const LEFT & x, const RIGHT & y) const
1011 {
1012 return ( x <= y ? x : y );
1013 }
1014 };
1015
1016 template <typename LEFT, typename RIGHT = LEFT>
1017 struct select_max: public std::binary_function<LEFT, RIGHT, typename select_result<LEFT,RIGHT>::result_type>
1018 {
1020 operator() (const LEFT & x, const RIGHT & y) const
1021 {
1022 return ( x >= y ? x : y );
1023 }
1024 };
1025
1026 //==========================================================================
1027 // Specialization: cfloat/cdouble
1028 //==========================================================================
1029
1030 // By default, cfloat values can only be multiplied/divided by floats
1031 // and cdouble by doubles.
1032
1033 template <>
1034 struct multiplies<cfloat, double>: public std::binary_function<cfloat, double, cfloat>
1035 {
1036 cfloat operator() (const cfloat & x, const double & y) const
1037 {
1038 return x * (float)y;
1039 }
1040 };
1041
1042 template <>
1043 struct multiplies<cfloat, long>: public std::binary_function<cfloat, long, cfloat>
1044 {
1045 cfloat operator() (const cfloat & x, const long & y) const
1046 {
1047 return x * (float)y;
1048 }
1049 };
1050
1051 template <>
1052 struct multiplies<cdouble, float>: public std::binary_function<cdouble, float, cdouble>
1053 {
1054 cdouble operator() (const cdouble & x, const float & y) const
1055 {
1056 return x * (double)y;
1057 }
1058 };
1059
1060 template <>
1061 struct multiplies<cdouble, long>: public std::binary_function<cdouble, long, cdouble>
1062 {
1063 cdouble operator() (const cdouble & x, const long & y) const
1064 {
1065 return x * (double)y;
1066 }
1067 };
1068
1069 template <>
1070 struct divides<cfloat, double>: public std::binary_function<cfloat, double, cfloat>
1071 {
1072 cfloat operator() (const cfloat & x, const double & y) const
1073 {
1074 return x * (float)( 1. / y );
1075 }
1076 };
1077
1078 template <>
1079 struct divides<cfloat, long>: public std::binary_function<cfloat, long, cfloat>
1080 {
1081 cfloat operator() (const cfloat & x, const long & y) const
1082 {
1083 return x * (float)( 1. / (double)y );
1084 }
1085 };
1086
1087 template <>
1088 struct divides<cdouble, float>: public std::binary_function<cdouble, float, cdouble>
1089 {
1090 cdouble operator() (const cdouble & x, const float & y) const
1091 {
1092 return x * (double)( 1. / y );
1093 }
1094 };
1095
1096 template <>
1097 struct divides<cdouble, double>: public std::binary_function<cdouble, double, cdouble>
1098 {
1099 cdouble operator() (const cdouble & x, const double & y) const
1100 {
1101 return x * ( 1. / y );
1102 }
1103 };
1104
1105 template <>
1106 struct divides<cdouble, long>: public std::binary_function<cdouble, long, cdouble>
1107 {
1108 cdouble operator() (const cdouble & x, const long & y) const
1109 {
1110 return x * (double)( 1. / (double)y );
1111 }
1112 };
1113
1114 template <>
1115 struct logical_and<bool, cfloat>: public std::binary_function<bool, cfloat, bool>
1116 {
1117 bool operator() (const bool & x, const cfloat & y) const
1118 {
1119 return x && ( y.imag() || y.real() );
1120 }
1121 };
1122
1123 template <>
1124 struct logical_and<bool, cdouble>: public std::binary_function<bool, cdouble, bool>
1125 {
1126 bool operator() (const bool & x, const cdouble & y) const
1127 {
1128 return x && ( y.imag() || y.real() );
1129 }
1130 };
1131
1132 template <>
1133 struct logical_or<bool, cfloat>: public std::binary_function<bool, cfloat, bool>
1134 {
1135 bool operator() (const bool & x, const cfloat & y) const
1136 {
1137 return x || y.imag() || y.real();
1138 }
1139 };
1140
1141 template <>
1142 struct logical_or<bool, cdouble>: public std::binary_function<bool, cdouble, bool>
1143 {
1144 bool operator() (const bool & x, const cdouble & y) const
1145 {
1146 return x || y.imag() || y.real();
1147 }
1148 };
1149
1150 template <>
1151 struct logical_not<cfloat>: public std::unary_function<cfloat, bool>
1152 {
1153 bool operator() (const cfloat & x) const
1154 {
1155 return !( x.imag() || x.real() );
1156 }
1157 };
1158
1159 template <>
1160 struct logical_not<cdouble>: public std::unary_function<cdouble, bool>
1161 {
1162 bool operator() (const cdouble & x) const
1163 {
1164 return !( x.imag() || x.real() );
1165 }
1166 };
1167
1168 //==========================================================================
1169 // Specialization: bool
1170 //==========================================================================
1171
1172 template <>
1173 struct increment<bool>: public std::unary_function<bool, bool>
1174 {
1175 bool operator() ( bool )
1176 {
1177 return true;
1178 }
1179 };
1180
1181 template <>
1182 struct decrement<bool>: public std::unary_function<bool, bool>
1183 {
1184 bool operator() ( bool )
1185 {
1186 return false;
1187 }
1188 };
1189
1190} // namespace volumeutil
1191} // namespace carto
1192
1193 //==========================================================================
1194 // Specialization: VoxelRGB/VoxelRGBA/VoxelHSV
1195 //==========================================================================
1196
1197 // operator- (VoxelRGB/RGBA/HSV) is called in pyaims (even though the
1198 // channel type is unsigned).
1199 // Thus, it needs to be defined to avoid a compilation error.
1200
1201#include <cartobase/type/voxelrgb.h>
1202#include <cartobase/type/voxelrgba.h>
1203#include <cartobase/type/voxelhsv.h>
1204
1205namespace carto {
1206namespace volumeutil {
1207
1208 template <>
1209 struct negate<VoxelRGB>: public std::unary_function<VoxelRGB, VoxelRGB>
1210 {
1212 {
1213 return x * -1.f;
1214 }
1215 };
1216
1217 template <>
1218 struct negate<VoxelRGBA>: public std::unary_function<VoxelRGBA, VoxelRGBA>
1219 {
1221 {
1222 return x * -1.f;
1223 }
1224 };
1225
1226 template <>
1227 struct negate<VoxelHSV>: public std::unary_function<VoxelHSV, VoxelHSV>
1228 {
1230 {
1231 return x * -1.f;
1232 }
1233 };
1234
1235} // namespace volumeutil
1236} // namespace carto
1237
1238#endif // CARTODATA_VOLUME_FUNCTIONAL_H
CONTAINER1< typename bitwise_and_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:278
CONTAINER< typename bitwise_and_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:262
CONTAINER< typename bitwise_and_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:269
typedef typeof(LEFT() &RIGHT()) result_type
bitwise_and_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:953
LEFT operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:991
T operator()(const T &x) const
Definition functional.h:982
CONTAINER1< typename bitwise_or_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:314
CONTAINER< typename bitwise_or_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:298
CONTAINER< typename bitwise_or_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:305
typedef typeof(LEFT()|RIGHT()) result_type
bitwise_or_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:963
LEFT operator()(const LEFT &x, const RIGHT &y) const
CONTAINER1< typename bitwise_xor_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:350
CONTAINER< typename bitwise_xor_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:334
CONTAINER< typename bitwise_xor_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:341
typedef typeof(LEFT() ^ RIGHT()) result_type
bitwise_xor_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:973
CONTAINER1< typename divides_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:204
CONTAINER< typename divides_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:188
CONTAINER< typename divides_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:195
typedef typeof(LEFT()/RIGHT()) result_type
divides_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:825
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:871
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:907
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:889
const T & operator()(const T &x) const
Definition functional.h:785
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:916
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:898
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:925
bool operator()(const T &x) const
Definition functional.h:943
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:934
CONTAINER1< typename minus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:134
CONTAINER< typename minus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:118
CONTAINER< typename minus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:125
typedef typeof(LEFT() - RIGHT()) result_type
minus_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:805
CONTAINER1< typename modulus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:242
CONTAINER< typename modulus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:225
CONTAINER< typename modulus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:233
typedef typeof(LEFT() % RIGHT()) result_type
modulus_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:835
CONTAINER1< typename multiplies_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:168
CONTAINER< typename multiplies_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:154
CONTAINER< typename multiplies_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:161
typedef typeof(LEFT() *RIGHT()) result_type
multiplies_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:815
T operator()(const T &x) const
Definition functional.h:844
bool operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:880
CONTAINER1< typename plus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:98
CONTAINER< typename plus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:82
CONTAINER< typename plus_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:89
typedef typeof(LEFT()+RIGHT()) result_type
plus_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
Definition functional.h:795
const LEFT & operator()(const LEFT &x, const RIGHT &) const
Definition functional.h:767
select_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
select_result< LEFT, RIGHT >::result_type operator()(const LEFT &x, const RIGHT &y) const
CONTAINER1< typename select_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:387
CONTAINER< typename select_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:371
CONTAINER< typename select_result< LEFT, RIGHT >::result_type > result_type
Definition functional.h:378
typedef typeof(true ? LEFT() :RIGHT()) result_type
const RIGHT & operator()(const LEFT &, const RIGHT &y) const
Definition functional.h:776
std::complex< double > cdouble
std::complex< float > cfloat