Skip to content

Commit ef4c2d7

Browse files
committed
Removed unnecessary EraseIfPartitioned algo
1 parent 16669bb commit ef4c2d7

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

Spatialization/include/JPLSpatial/Algo/Algorithm.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,4 @@ namespace JPL::Algo
115115
const ElementType sum2 = Accumulate(data, ElementType(0), AccPow2<ElementType>{});
116116
return Math::IsNearlyEqual(static_cast<float>(sum2), 1.0f, tolerance);
117117
}
118-
119-
template <std::ranges::random_access_range Range, class Predicate>
120-
JPL_INLINE void ErasePartitionUnordered(Range& container, Predicate predicate)
121-
{
122-
auto rangeToErase = std::ranges::partition(container, [&](auto& v)
123-
{
124-
return not predicate(v);
125-
});
126-
container.erase(rangeToErase.begin(), container.end());
127-
}
128-
129118
} // namespace JPL::Algo

Spatialization/include/JPLSpatial/PathTracing/SpecularRayTracing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ namespace JPL
582582
inline auto SpecularRayTracing::ProcessRoutine<SceneType, SpecularPathCacheContainer>::PreprocessTraces(TraceResults<Intersection>& traces) -> TraceInfo
583583
{
584584
// Remove empty paths
585-
Algo::ErasePartitionUnordered(traces.Paths, [](const auto& path) { return path.Nodes.empty(); });
585+
std::erase_if(traces.Paths, [](const auto& path) { return path.Nodes.empty(); });
586586

587587
#if 0 //! not worth extra allocations to remove 1 in a million duplicate (we cull subpath duplicates later anyway)
588588
// Second, remove duplicate surface paths
@@ -597,7 +597,7 @@ namespace JPL
597597

598598
//! Note: this only removes the full paths, not the subpaths
599599
//! (subpath is a path up to Nth node/order within a full path)
600-
Algo::ErasePartitionUnordered(paths, [&uniqueKeys](const auto& path)
600+
std::erase_if(paths, [&uniqueKeys](const auto& path)
601601
{
602602
return not uniqueKeys.Insert(path.Nodes.back().Hash);
603603
});

0 commit comments

Comments
 (0)