diff options
author | Adrian Kummerlaender | 2016-12-11 12:36:04 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2016-12-11 12:37:09 +0100 |
commit | dbbef17103dc21c085c8b5713433fb730a5f8d3a (patch) | |
tree | a5c19ae0d025a7d94a93afdfb662eea33e599ea6 /src/util/box_traverser.h | |
parent | 93c5f7356364bd6e0276dddd0a78bcb50085629f (diff) | |
download | termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.tar termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.tar.gz termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.tar.bz2 termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.tar.lz termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.tar.xz termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.tar.zst termlife-dbbef17103dc21c085c8b5713433fb730a5f8d3a.zip |
Move `util` namespace classes into matching folder
Diffstat (limited to 'src/util/box_traverser.h')
-rw-r--r-- | src/util/box_traverser.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util/box_traverser.h b/src/util/box_traverser.h new file mode 100644 index 0000000..cb7dfeb --- /dev/null +++ b/src/util/box_traverser.h @@ -0,0 +1,26 @@ +#ifndef LIFE_SRC_UTIL_BOX_TRAVERSER_ +#define LIFE_SRC_UTIL_BOX_TRAVERSER_ + +#include <functional> + +#include "box_indicator.h" + +namespace life { +namespace util { + +struct BoxTraverser : public BoxIndicator { + using BoxIndicator::BoxIndicator; + + void for_each(const std::function<void(std::size_t, std::size_t)> f) const { + for ( std::size_t x = this->a_x_; x < this->b_x_; x++ ) { + for ( std::size_t y = this->a_y_; y < this->b_y_; y++ ) { + f(x, y); + } + } + } +}; + +} +} + +#endif // LIFE_SRC_UTIL_BOX_TRAVERSER_ |