Skip to content

Commit

Permalink
fix Indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
yaito3014 committed Jul 18, 2024
1 parent 9c77228 commit c7b7aac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Siv3D/include/Siv3D/detail/Indexed.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ namespace s3d

struct Iterator
{
using value_type = std::tuple<size_t, typename std::iterator_traits<It>::value_type>;
using reference = std::tuple<size_t, decltype(*std::declval<It&>())>;
size_t index;
It it;
constexpr bool operator != (const Iterator& other) const { return it != other.it; }
constexpr void operator ++() { ++index; ++it; }
constexpr auto operator *() const { return std::tie(index, *it); }
constexpr auto operator *() const { return reference{ index, *it }; }
};

struct IterableWrapper
Expand All @@ -48,11 +50,13 @@ namespace s3d
{
struct Iterator
{
using value_type = std::tuple<size_t, typename std::iterator_traits<It>::value_type>;
using reference = std::tuple<size_t, decltype(*std::declval<It&>())>;
size_t index;
It it;
constexpr bool operator != (const Iterator& other) const { return it != other.it; }
constexpr void operator ++() { --index; ++it; }
constexpr auto operator *() const { return std::tie(index, *it); }
constexpr auto operator *() const { return reference{ index, *it }; }
};

struct IterableWrapper
Expand Down

0 comments on commit c7b7aac

Please sign in to comment.