diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-08 14:08:22 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-08 14:08:22 +0200 |
| commit | 4d39911eea55caac4016a1f7a92fbcb202797d42 (patch) | |
| tree | 67d559e2c762bd6a6c6471157d3869d0fa720b07 | |
| parent | 036f48e9d9d13d3aa5b552c5e3997fa152aa6ba3 (diff) | |
a
| -rw-r--r-- | src/tile-iterator.hpp | 11 | ||||
| -rw-r--r-- | test/tile-iter.cpp | 10 |
2 files changed, 12 insertions, 9 deletions
diff --git a/src/tile-iterator.hpp b/src/tile-iterator.hpp index 0fa5049d..4be601c2 100644 --- a/src/tile-iterator.hpp +++ b/src/tile-iterator.hpp @@ -14,13 +14,8 @@ struct tile; namespace std { -template<typename T> -void swap(Magnum::Examples::basic_tile_iterator<T>& lhs, - Magnum::Examples::basic_tile_iterator<T>& rhs) noexcept; - template<typename T> struct tuple_element<0, Magnum::Examples::basic_tile_iterator<T>> { using type = T&; }; template<typename T> struct tuple_element<0, const Magnum::Examples::basic_tile_iterator<T>> { using type = const T&; }; - template<typename T> struct tuple_element<1, Magnum::Examples::basic_tile_iterator<T>> { using type = std::size_t; }; template<typename T> struct tuple_element<2, Magnum::Examples::basic_tile_iterator<T>> { using type = Magnum::Examples::local_coords; }; template<typename T> struct tuple_size<Magnum::Examples::basic_tile_iterator<T>> : std::integral_constant<std::size_t, 3> {}; @@ -43,10 +38,8 @@ public: basic_tile_iterator<T>& operator=(const basic_tile_iterator<T>&) = default; basic_tile_iterator<T>& operator++() { pos++; return *this; } basic_tile_iterator<T> operator++(int) { auto tmp = *this; operator++(); return tmp; } - basic_tile_iterator<T>* operator->() & { return this; } - basic_tile_iterator<T>& operator*() & { return *this; } - basic_tile_iterator<T> const* operator->() const& { return this; } - basic_tile_iterator<T> const& operator*() const& { return *this; } + basic_tile_iterator<T>* operator->() { return this; } + basic_tile_iterator<T>& operator*() { return *this; } auto operator<=>(const basic_tile_iterator<T>&) const noexcept = default; void swap(basic_tile_iterator<T>& other); template<std::size_t N> typename std::tuple_element<N, basic_tile_iterator<T>>::type get() &; diff --git a/test/tile-iter.cpp b/test/tile-iter.cpp index f930517f..a6a5db8a 100644 --- a/test/tile-iter.cpp +++ b/test/tile-iter.cpp @@ -19,6 +19,8 @@ bool app::test_tile_iter() // NOLINT(readability-function-size) static_assert(std::is_same_v<decltype(x), const tile&>); for (auto [x, k, pt] : c) static_assert(std::is_same_v<decltype(x), const tile&>); + for (auto&& [x, k, pt] : c) + static_assert(std::is_same_v<decltype(x), const tile&>); } if (always_false()) { @@ -29,6 +31,14 @@ bool app::test_tile_iter() // NOLINT(readability-function-size) static_assert(std::is_same_v<decltype(x), const tile&>); for (auto [x, k, pt] : c) static_assert(std::is_same_v<decltype(x), tile&>); + for (const auto [x, k, pt] : c) + static_assert(std::is_same_v<decltype(x), const tile&>); + for (auto&& [x, k, pt] : c) + static_assert(std::is_same_v<decltype(x), tile&>); +#if 0 + for (const auto&& [x, k, pt] : c) + static_assert(std::is_same_v<decltype(x), const tile&>); +#endif } return true; } |
