Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
interaction_builder.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
6
7namespace bb::avm2::tracegen {
8
10 public:
11 virtual ~InteractionBuilderInterface() = default;
12 virtual void process(TraceContainer& trace) = 0;
13};
14
15// A concatenate that works with movable objects.
16template <typename T> std::vector<T> concatenate_jobs(std::vector<T>&& first, auto&&... rest)
17{
18 std::vector<T> result = std::move(first);
19 result.reserve(first.size() + (rest.size() + ...));
20 (std::move(rest.begin(), rest.end(), std::back_inserter(result)), ...);
21 return result;
22}
23
24} // namespace bb::avm2::tracegen
25
26// Define a hash function for std::array so that it can be used as a key in a std::unordered_map.
27template <typename T, size_t SIZE> struct std::hash<std::array<T, SIZE>> {
28 inline std::size_t operator()(const std::array<T, SIZE>& arr) const noexcept
29 {
30 return [&arr]<size_t... Is>(std::index_sequence<Is...>) {
31 return bb::utils::hash_as_tuple(arr[Is]...);
33 }
34};
virtual void process(TraceContainer &trace)=0
TestTraceContainer trace
std::vector< T > concatenate_jobs(std::vector< T > &&first, auto &&... rest)
size_t hash_as_tuple(const Ts &... ts)
Definition utils.hpp:22
STL namespace.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::size_t operator()(const std::array< T, SIZE > &arr) const noexcept