Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
interaction_builder.cpp
Go to the documentation of this file.
2
3#include <algorithm>
4
6
7namespace bb::avm2::tracegen {
8
10{
11 // Identify first occurrences of each fingerprint.
12 unordered_flat_set<size_t> seen_fingerprints;
14
15 for (const auto& job : jobs) {
16 auto fp = job->get_destination_columns_fingerprint();
17 auto [_, inserted] = seen_fingerprints.insert(fp);
18 if (inserted) {
19 first_occurrence_jobs.insert(job.get());
20 }
21 }
22
23 // Stable partition: first occurrences come first.
24 std::ranges::stable_partition(jobs, [&](const auto& job) { return first_occurrence_jobs.contains(job.get()); });
25}
26
27} // namespace bb::avm2::tracegen
void order_jobs_by_destination_columns(std::vector< std::unique_ptr< InteractionBuilderInterface > > &jobs)
::ankerl::unordered_dense::set< Key > unordered_flat_set
Definition set.hpp:11
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13