summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2021-03-20 21:02:55 +0100
committerJaron Kent-Dobias <jaron@kent-dobias.com>2021-03-20 21:02:55 +0100
commit2a60bf7c1ed0396045125e279c6f40dca5d40ba6 (patch)
tree8fa7c813189fdfbe9dc5671f44aa2add51766cf7
parente4dd2fa788530142949c144e773eb4ffbd1ed5ed (diff)
downloadlattice_glass-2a60bf7c1ed0396045125e279c6f40dca5d40ba6.tar.gz
lattice_glass-2a60bf7c1ed0396045125e279c6f40dca5d40ba6.tar.bz2
lattice_glass-2a60bf7c1ed0396045125e279c6f40dca5d40ba6.zip
Fixed stack overflow, still slow...
-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;