mirror of
https://github.com/open-goal/jak-project
synced 2026-06-20 16:21:35 -04:00
997c1ab60a
A common thing that can be forgotten about / confusing to new people is that: 1. if you add an object to the `allowed_objs` list but it's also in the `banned_objs` list -- the ban still takes precedence with no failure 2. if you add an object to the `allowed_objs` list but have not allowed the DGO in `inputs.jsonc` it will also silently log a failure and continue. This PR turns both situations into an explicit error with advice/a reminder on what to do to fix it.
23 lines
485 B
C++
23 lines
485 B
C++
#pragma once
|
|
|
|
#include <unordered_set>
|
|
|
|
namespace set_util {
|
|
template <typename T>
|
|
std::unordered_set<T> intersection(std::unordered_set<T>& set1, std::unordered_set<T>& set2) {
|
|
if (set2.size() < set1.size()) {
|
|
auto temp = set1;
|
|
set1 = set2;
|
|
set2 = temp;
|
|
}
|
|
std::unordered_set<T> m(set1.begin(), set1.end());
|
|
std::unordered_set<T> res;
|
|
for (auto a : set2)
|
|
if (m.count(a)) {
|
|
res.insert(a);
|
|
m.erase(a);
|
|
}
|
|
return res;
|
|
}
|
|
} // namespace set_util
|