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
4#include "msgpack.hpp"
6
7namespace msgpack {
11template <msgpack_concepts::HasMsgPack T> void msgpack_apply(const auto& func, auto&... args)
12{
13 std::apply(func, msgpack::drop_keys(std::tie(args...)));
14}
20template <msgpack_concepts::HasMsgPack T> void msgpack_apply(const T& value, const auto& func)
21{
22 // We must use const_cast as our method is meant to be polymorphic over const, but there's no such concept in C++
23 const_cast<T&>(value).msgpack([&](auto&... args) { // NOLINT
24 msgpack_apply<T>(func, args...);
25 });
26}
27} // 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.