diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-24 22:55:06 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-24 22:55:06 +0200 |
commit | 9076ef2ee672877bbf339d5ca8db182445f127f7 (patch) | |
tree | b1c2c8a379e864867f8ad3878fc81d9f06fa1bda /src/chunk.hpp | |
parent | 27a04888cfeca3d3db127744dde60b67fe497b94 (diff) |
a
Diffstat (limited to 'src/chunk.hpp')
-rw-r--r-- | src/chunk.hpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/chunk.hpp b/src/chunk.hpp index f0ed1426..3bf66920 100644 --- a/src/chunk.hpp +++ b/src/chunk.hpp @@ -10,30 +10,29 @@ template<typename T> class basic_tile_iterator; struct chunk final { - tile& operator[](local_coords xy) { return _tiles[xy.to_index()]; } - const tile& operator[](local_coords xy) const { return _tiles[xy.to_index()]; } - tile& operator[](std::size_t i) { return _tiles[i]; } - const tile& operator[](std::size_t i) const { return _tiles[i]; } - const auto& tiles() const { return _tiles; } - auto& tiles() { return _tiles; } + tile& operator[](local_coords xy) noexcept { return _tiles[xy.to_index()]; } + const tile& operator[](local_coords xy) const noexcept { return _tiles[xy.to_index()]; } + tile& operator[](std::size_t i) noexcept { return _tiles[i]; } + const tile& operator[](std::size_t i) const noexcept { return _tiles[i]; } + const auto& tiles() const noexcept { return _tiles; } + auto& tiles() noexcept { return _tiles; } using iterator = basic_tile_iterator<tile>; using const_iterator = basic_tile_iterator<const tile>; - iterator begin() { return iterator{_tiles.data(), 0}; } - iterator end() { return iterator{_tiles.data(), _tiles.size()}; } - const_iterator cbegin() const { return const_iterator{_tiles.data(), 0}; } - const_iterator cend() const { return const_iterator{_tiles.data(), _tiles.size()}; } - const_iterator begin() const { return cbegin(); } - const_iterator end() const { return cend(); } + iterator begin() noexcept { return iterator{_tiles.data(), 0}; } + iterator end() noexcept { return iterator{_tiles.data(), _tiles.size()}; } + const_iterator cbegin() const noexcept { return const_iterator{_tiles.data(), 0}; } + const_iterator cend() const noexcept { return const_iterator{_tiles.data(), _tiles.size()}; } + const_iterator begin() const noexcept { return cbegin(); } + const_iterator end() const noexcept { return cend(); } - bool empty() const; + bool empty(bool force = false) const noexcept; - chunk() = default; - chunk(chunk&&) = default; - chunk& operator=(chunk&&) = default; + chunk() noexcept = default; fm_DECLARE_DELETED_COPY_ASSIGNMENT(chunk); + fm_DECLARE_DEFAULT_MOVE_ASSIGNMENT_(chunk); private: std::array<tile, TILE_COUNT> _tiles = {}; |