22 void filter (
const AIPtr& entity)
override;
25 inline void Difference::filter (
const AIPtr& entity) {
26 FilteredEntities& filtered = getFilteredEntities(entity);
28 const FilteredEntities alreadyFiltered = filtered;
32 std::vector<FilteredEntities> filteredArray(_filters.size());
35 for (
auto& f : _filters) {
37 filteredArray[n++] = filtered;
38 max = std::max(filtered.size(), max);
43 for (
size_t i = 0; i < filteredArray.size(); ++i) {
44 std::sort(filteredArray[i].begin(), filteredArray[i].end());
47 FilteredEntities result(max);
49 filteredArray[0].begin(), filteredArray[0].end(),
50 filteredArray[1].begin(), filteredArray[1].end(),
51 std::back_inserter(result));
53 if (filteredArray.size() >= 2) {
54 FilteredEntities buffer(max);
55 for (
size_t i = 2; i < filteredArray.size(); ++i) {
57 std::sort(result.begin(), result.end());
59 result.begin(), result.end(),
60 filteredArray[i].begin(), filteredArray[i].end(),
61 std::back_inserter(buffer));
62 std::swap(result, buffer);
66 filtered.reserve(alreadyFiltered.size() + max);
67 for (
auto& e : alreadyFiltered) {
68 filtered.push_back(e);
70 for (
auto& e : result) {
71 filtered.push_back(e);
This filter performs a difference operation between several filter results. The result consists of el...
Definition: Difference.h:17