summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--glass.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/glass.cpp b/glass.cpp
index 7623765..e8739d0 100644
--- a/glass.cpp
+++ b/glass.cpp
@@ -139,7 +139,7 @@ template<unsigned D> class System {
if (overlaps(p).empty()) {
typename std::unordered_map<unsigned, Particle<D>>::iterator it;
std::tie(it, std::ignore) = particles.insert({r.uniform((unsigned)0, (unsigned)pow(2, 28)), p});
- p.position.occupant = std::prev(particles.end());
+ p.position.occupant = it;
return true;
} else {
return false;