OpenFPM_data  0.1.0
Project that contain the implementation and interfaces for basic structure like vectors, grids, graph ... .
 All Data Structures Namespaces Functions Variables Typedefs Friends
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 
16 template<typename bfv>
18 {
19  bool eq;
20 
21  const bfv & src;
22  const bfv & dst;
23 
31  inline compare_fusion_vector(const bfv & src, const bfv & dst)
32  :eq(true),src(src),dst(dst){};
33 
34 #ifdef SE_CLASS1
35 
41  inline compare_fusion_vector(const bfv && src, const bfv && dst)
42  :eq(true),src(src),dst(dst)
43  {std::cerr << "Error: " <<__FILE__ << ":" << __LINE__ << " Passing a temporal object\n";};
44 #endif
45 
47  template<typename T>
48  inline void operator()(T& t)
49  {
50  // This is the type of the object we have to copy
51  typedef typename boost::fusion::result_of::at_c<bfv,T::value>::type copy_type;
52 
53  // Remove the reference from the type to copy
54  typedef typename boost::remove_reference<copy_type>::type copy_rtype;
55 
56  if (eq == false)
57  return;
58 
59  eq = meta_compare<copy_rtype>::meta_compare_f(boost::fusion::at_c<T::value>(src),boost::fusion::at_c<T::value>(dst));
60  }
61 
67  inline bool result()
68  {
69  return eq;
70  }
71 };
72 
73 
74 
75 #endif /* OPENFPM_DATA_SRC_UTIL_COMPARE_FUSION_VECTOR_HPP_ */
this class is a functor for "for_each" algorithm
bool result()
Returh the result of the comparison.
compare_fusion_vector(const bfv &src, const bfv &dst)
constructor
This class compare general objects.
void operator()(T &t)
It call the copy function for each property.