OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
meta_compare.hpp
1/*
2 * meta_compare.hpp
3 *
4 * Created on: Oct 31, 2015
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_DATA_SRC_UTIL_META_COMPARE_HPP_
9#define OPENFPM_DATA_SRC_UTIL_META_COMPARE_HPP_
10
11#include "compare_general.hpp"
12
36template<typename T>
38{
39 static inline bool meta_compare_f(const T & src, const T & dst)
40 {
42 }
43};
44
46template<typename T,size_t N1>
47struct meta_compare<T[N1]>
48{
49 static inline bool meta_compare_f(const T (& src)[N1], const T (& dst)[N1])
50 {
51 for (size_t i1 = 0 ; i1 < N1 ; i1++)
52 {
53 if (compare_general<T>::compare_general_f(src[i1],dst[i1]) == false)
54 return false;
55 }
56
57 return true;
58 }
59};
60
62template<typename T,size_t N1,size_t N2>
63struct meta_compare<T[N1][N2]>
64{
65 static inline bool meta_compare_f(const T (& src)[N1][N2], const T (& dst)[N1][N2])
66 {
67 for (size_t i1 = 0 ; i1 < N1 ; i1++)
68 {
69 for (size_t i2 = 0 ; i2 < N2 ; i2++)
70 {
71 if (compare_general<T>::compare_general_f(src[i1][i2],dst[i1][i2]) == false)
72 return false;
73 }
74 }
75
76 return true;
77 }
78};
79
81template<typename T,size_t N1,size_t N2,size_t N3>
82struct meta_compare<T[N1][N2][N3]>
83{
84 static inline bool meta_compare_f(const T (& src)[N1][N2][N3], const T (& dst)[N1][N2][N3])
85 {
86 for (size_t i1 = 0 ; i1 < N1 ; i1++)
87 {
88 for (size_t i2 = 0 ; i2 < N2 ; i2++)
89 {
90 for (size_t i3 = 0 ; i3 < N3 ; i3++)
91 {
92 if (compare_general<T>::compare_general_f(src[i1][i2][i3],dst[i1][i2][i3]) == false)
93 return false;
94 }
95 }
96 }
97
98 return true;
99 }
100};
101
102
103
104
105#endif /* OPENFPM_DATA_SRC_UTIL_META_COMPARE_HPP_ */
structure to copy aggregates
static bool compare_general_f(const T &src, const T &dst)
Spacialization when there is unknown compare method.
This class compare general objects.