ttg 1.0.0
Template Task Graph (TTG): flowgraph-based programming model for high-performance distributed-memory algorithms
Loading...
Searching...
No Matches
tuple.h
Go to the documentation of this file.
1// SPDX-License-Identifier: BSD-3-Clause
2//
3// Created by Eduard Valeyev on 5/11/21.
4//
5
6#ifndef TTG_SERIALIZATION_STD_TUPLE_H
7#define TTG_SERIALIZATION_STD_TUPLE_H
8
10
11#ifdef TTG_SERIALIZATION_SUPPORTS_MADNESS
12// MADNESS supports std::tuple serialization by default
13#endif
14
15#ifdef TTG_SERIALIZATION_SUPPORTS_BOOST
16
17namespace boost {
18 namespace serialization {
19
20 namespace detail {
21
22 template <typename Archive, typename... Ts, std::size_t... Is>
23 Archive& tuple_serialize_impl(Archive& ar, std::tuple<Ts...>& t, std::index_sequence<Is...>) {
24 ((ar & std::get<Is>(t)), ...);
25 return ar;
26 }
27
28 } // namespace detail
29
30 template <typename Archive, typename... Ts>
31 Archive& serialize(Archive& ar, std::tuple<Ts...>& t, const unsigned int version) {
32 detail::tuple_serialize_impl(ar, t, std::make_index_sequence<sizeof...(Ts)>{});
33 return ar;
34 }
35
36 } // namespace serialization
37} // namespace boost
38
39namespace ttg::detail {
40 template <typename Archive, typename... Ts>
41 inline static constexpr bool is_stlcontainer_boost_serializable_v<Archive, std::tuple<Ts...>> =
42 (is_boost_serializable_v<Archive, Ts> && ...);
43 template <typename Archive, typename... Ts>
44 inline static constexpr bool is_stlcontainer_boost_serializable_v<Archive, const std::tuple<Ts...>> =
45 (is_boost_serializable_v<Archive, const Ts> && ...);
46} // namespace ttg::detail
47
48#endif // TTG_SERIALIZATION_SUPPORTS_BOOST
49
50#endif // TTG_SERIALIZATION_STD_TUPLE_H