YPC  0.2.0
copy_helper.h
1 #pragma once
2 #include <ff/util/type_list.h>
3 
4 namespace hpda {
5 namespace processor {
6 namespace internal {
7 
8 template <int Index> struct copy_helper {
9  // TODO optimize for rvalue(&&)
10  template <typename T1, typename T2>
11  static auto copy(T1 &target, T2 &&source) -> typename std::enable_if<
12  (std::remove_reference<T2>::type::type_list::len > Index), void>::type {
13  typedef typename ::ff::util::get_type_at_index_in_typelist<
14  typename std::remove_reference<T2>::type::type_list, Index>::type
15  c_type;
16  target.template set<c_type>(source.template get<c_type>());
17  copy_helper<Index + 1>::copy(target, std::forward<T2>(source));
18  }
19 
20  template <typename T1, typename T2>
21  static auto copy(T1 &target, const T2 &source) -> typename std::enable_if<
22  (std::remove_reference<T2>::type::type_list::len <= Index), void>::type {}
23 };
24 
25 } // namespace internal
26 } // namespace processor
27 } // namespace hpda
hpda::processor::internal::copy_helper
Definition: copy_helper.h:8