Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
msgpack_apply.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "msgpack.hpp"
5
6namespace msgpack {
10template <msgpack_concepts::HasMsgPack T> void msgpack_apply(const auto& func, auto&... args)
11{
12 std::apply(func, msgpack::drop_keys(std::tie(args...)));
13}
19template <msgpack_concepts::HasMsgPack T> void msgpack_apply(const T& value, const auto& func)
20{
21 // We must use const_cast as our method is meant to be polymorphic over const, but there's no such concept in C++
22 const_cast<T&>(value).msgpack([&](auto&... args) { // NOLINT
23 msgpack_apply<T>(func, args...);
24 });
25}
26} // namespace msgpack
auto drop_keys(std::tuple< Args... > &&tuple)
Drops every first value pairwise of a flat argument tuple, assuming that they are keys.
Definition drop_keys.hpp:15
void msgpack_apply(const auto &func, auto &... args)
Helper method for better error reporting. Clang does not give the best errors for lambdas.