// Copyright (c) 2025 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef MP_PROXY_TYPE_TUPLE_H #define MP_PROXY_TYPE_TUPLE_H #include namespace mp { // TODO: Should generalize this to work with arbitrary length tuples, not just length 2-tuples. template void CustomBuildField(TypeList>, Priority<1>, InvokeContext& invoke_context, Value&& value, Output&& output) { auto pair = output.init(); using Accessors = typename ProxyStruct::Accessors; BuildField(TypeList(), invoke_context, Make>(pair), std::get<0>(value)); BuildField(TypeList(), invoke_context, Make>(pair), std::get<1>(value)); } // TODO: Should generalize this to work with arbitrary length tuples, not just length 2-tuples. template decltype(auto) CustomReadField(TypeList>, Priority<1>, InvokeContext& invoke_context, Input&& input, ReadDest&& read_dest) { return read_dest.update([&](auto& value) { const auto& pair = input.get(); using Struct = ProxyStruct::Reads>; using Accessors = typename Struct::Accessors; ReadField(TypeList(), invoke_context, Make>(pair), ReadDestUpdate(std::get<0>(value))); ReadField(TypeList(), invoke_context, Make>(pair), ReadDestUpdate(std::get<1>(value))); }); } } // namespace mp #endif // MP_PROXY_TYPE_TUPLE_H