aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2016-12-11 17:42:00 +0100
committerAdrian Kummerlaender2016-12-11 17:42:00 +0100
commit575b204b4e39e06bbf4c74b5397c062196822040 (patch)
tree08d81d4b7b89db1fb24d73e2e442a1ce5d35eca0
parent0263d6fa06efb78912fc51441162c230dd2003ce (diff)
downloadtermlife-575b204b4e39e06bbf4c74b5397c062196822040.tar
termlife-575b204b4e39e06bbf4c74b5397c062196822040.tar.gz
termlife-575b204b4e39e06bbf4c74b5397c062196822040.tar.bz2
termlife-575b204b4e39e06bbf4c74b5397c062196822040.tar.lz
termlife-575b204b4e39e06bbf4c74b5397c062196822040.tar.xz
termlife-575b204b4e39e06bbf4c74b5397c062196822040.tar.zst
termlife-575b204b4e39e06bbf4c74b5397c062196822040.zip
Use implicity tuple creation for update scheduling
-rw-r--r--src/world.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/world.h b/src/world.h
index cabb4dd..61423c4 100644
--- a/src/world.h
+++ b/src/world.h
@@ -71,19 +71,19 @@ class World {
std::stack<std::tuple<std::size_t, std::size_t, bool>> updates;
this->area_.for_each([&](std::size_t i, std::size_t j) {
- const std::uint8_t d = this->lifeDensityAt(i, j);
+ const std::uint8_t d{this->lifeDensityAt(i, j)};
if ( this->matrix_[j][i] ) {
if ( d < 2 ) {
- updates.push(std::make_tuple(i, j, false));
+ updates.emplace(i, j, false);
} else if ( d == 2 || d == 3 ) {
- updates.push(std::make_tuple(i, j, true));
+ updates.emplace(i, j, true);
} else if ( d > 3 ) {
- updates.push(std::make_tuple(i, j, false));
+ updates.emplace(i, j, false);
}
} else {
if ( d == 3 ) {
- updates.push(std::make_tuple(i, j, true));
+ updates.emplace(i, j, true);
}
}
});
@@ -110,7 +110,7 @@ class World {
private:
const util::BoxTraverser area_;
- std::size_t age_ = 0;
+ std::size_t age_{};
std::array<std::array<bool, WIDTH>, HEIGHT> matrix_;
};