Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
drop_keys.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <tuple>
3
4
#ifndef IPC_CODEGEN_MSGPACK_DROP_KEYS_DEFINED
5
#define IPC_CODEGEN_MSGPACK_DROP_KEYS_DEFINED
6
7
namespace
msgpack
{
8
template
<
typename
Tuple,
std::size_t
... Is>
auto
drop_keys_impl
(Tuple&& tuple,
std::index_sequence<Is...>
)
9
{
10
// Expand 0 to n/2 to 1 to n+1 (increments of 2)
11
// Use it to filter the tuple
12
return
std::tie(
std::get<Is * 2 + 1>
(
std::forward<Tuple>
(tuple))...);
13
}
14
18
template
<
typename
... Args>
auto
drop_keys
(
std::tuple<Args...>
&& tuple)
19
{
20
static_assert
(
sizeof
...(Args) % 2 == 0,
"Tuple must contain an even number of elements"
);
21
// Compile time sequence of integers from 0 to n/2
22
auto
compile_time_0_to_n_div_2 =
std::make_index_sequence
<
sizeof
...(Args) / 2>{};
23
return
drop_keys_impl
(tuple, compile_time_0_to_n_div_2);
24
}
25
}
// namespace msgpack
26
27
#endif
msgpack
Definition
msgpack_apply.hpp:7
msgpack::drop_keys
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:18
msgpack::drop_keys_impl
auto drop_keys_impl(Tuple &&tuple, std::index_sequence< Is... >)
Definition
drop_keys.hpp:8
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
src
barretenberg
serialize
msgpack_impl
drop_keys.hpp
Generated by
1.9.8