OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
compare_fusion_vector.hpp
1/*
2 * compare_fusion_vector.hpp
3 *
4 * Created on: Nov 1, 2015
5 * Author: i-bird
6 */
7
8#ifndef OPENFPM_DATA_SRC_UTIL_COMPARE_FUSION_VECTOR_HPP_
9#define OPENFPM_DATA_SRC_UTIL_COMPARE_FUSION_VECTOR_HPP_
10
11#include "meta_compare.hpp"
12
18template<typename bfv>
20{
22 bool eq;
23
25 const bfv & src;
26
28 const bfv & dst;
29
38 inline compare_fusion_vector(const bfv & src, const bfv & dst)
39 :eq(true),src(src),dst(dst){};
40
41#ifdef SE_CLASS1
48 inline compare_fusion_vector(const bfv && src, const bfv && dst)
49 :eq(true),src(src),dst(dst)
50 {std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object\n";};
51#endif
52
60 template<typename T>
61 inline void operator()(T& t)
62 {
63 // This is the type of the object we have to copy
64 typedef typename boost::fusion::result_of::at_c<bfv,T::value>::type copy_type;
65
66 // Remove the reference from the type to copy
67 typedef typename boost::remove_reference<copy_type>::type copy_rtype;
68
69 if (eq == false)
70 return;
71
72 eq = meta_compare<copy_rtype>::meta_compare_f(boost::fusion::at_c<T::value>(src),boost::fusion::at_c<T::value>(dst));
73 }
74
80 inline bool result()
81 {
82 return eq;
83 }
84};
85
86
87
88#endif /* OPENFPM_DATA_SRC_UTIL_COMPARE_FUSION_VECTOR_HPP_ */
this class is a functor for "for_each" algorithm
compare_fusion_vector(const bfv &src, const bfv &dst)
constructor
void operator()(T &t)
It call the copy function for each property.
bool result()
Returh the result of the comparison.
bool eq
Result of the comparation.
This class compare general objects.