tuple.h
Go to the documentation of this file.
1 //
2 // Created by Eduard Valeyev on 5/11/21.
3 //
4 
5 #ifndef TTG_SERIALIZATION_STD_TUPLE_H
6 #define TTG_SERIALIZATION_STD_TUPLE_H
7 
9 
10 #ifdef TTG_SERIALIZATION_SUPPORTS_MADNESS
11 // MADNESS supports std::tuple serialization by default
12 #endif
13 
14 #ifdef TTG_SERIALIZATION_SUPPORTS_BOOST
15 
16 namespace boost {
17  namespace serialization {
18 
19  namespace detail {
20 
21  template <typename Archive, typename... Ts, std::size_t... Is>
22  Archive& tuple_serialize_impl(Archive& ar, std::tuple<Ts...>& t, std::index_sequence<Is...>) {
23  ((ar & std::get<Is>(t)), ...);
24  return ar;
25  }
26 
27  } // namespace detail
28 
29  template <typename Archive, typename... Ts>
30  Archive& serialize(Archive& ar, std::tuple<Ts...>& t, const unsigned int version) {
31  detail::tuple_serialize_impl(ar, t, std::make_index_sequence<sizeof...(Ts)>{});
32  return ar;
33  }
34 
35  } // namespace serialization
36 } // namespace boost
37 
38 namespace ttg::detail {
39  template <typename Archive, typename... Ts>
40  inline static constexpr bool is_stlcontainer_boost_serializable_v<Archive, std::tuple<Ts...>> =
41  (is_boost_serializable_v<Archive, Ts> && ...);
42  template <typename Archive, typename... Ts>
43  inline static constexpr bool is_stlcontainer_boost_serializable_v<Archive, const std::tuple<Ts...>> =
44  (is_boost_serializable_v<Archive, const Ts> && ...);
45 } // namespace ttg::detail
46 
47 #endif // TTG_SERIALIZATION_SUPPORTS_BOOST
48 
49 #endif // TTG_SERIALIZATION_STD_TUPLE_H
typename make_index_sequence_t< I... >::type make_index_sequence
std::array< int, 3 > version()
Definition: version.cc:4