Skip to content

Commit 0b65e24

Browse files
committed
Fixed braced-initializer cursor initialization
1 parent 62dfd56 commit 0b65e24

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

include/flux/adaptor/permutations.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class permutations_adaptor : public flux::inline_sequence_base<permutations_adap
113113
std::iota(indices.begin(), indices.end(), 0);
114114

115115
// return the cursor
116-
return {.indices_ = indices, .index_ = 0};
116+
return {.indices_ = indices, .permutation_index_ = 0};
117117
}
118118

119119
static constexpr auto last(self_t& self) -> cursor_type
@@ -130,7 +130,7 @@ class permutations_adaptor : public flux::inline_sequence_base<permutations_adap
130130
std::iota(indices.rbegin(), indices.rend(), 0);
131131

132132
// return the cursor
133-
return {.indices_ = indices, .index_ = self.count_permutations()};
133+
return {.indices_ = indices, .permutation_index_ = self.count_permutations()};
134134
}
135135

136136
static constexpr auto is_last([[maybe_unused]] self_t& self, const cursor_type& cursor)

include/flux/adaptor/permutations_sized.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ struct permutations_sized_adaptor
8383
struct cursor_type {
8484
std::vector<std::size_t> indices_;
8585
std::vector<std::size_t> cycles_;
86-
std::size_t index_;
86+
std::size_t permutation_index_;
8787

8888
[[nodiscard]] constexpr auto operator<=>(const cursor_type& other) const
8989
{
90-
return index_ <=> other.index_;
90+
return permutation_index_ <=> other.permutation_index_;
9191
}
9292
[[nodiscard]] constexpr bool operator==(const cursor_type& other) const
9393
{
94-
return index_ == other.index_;
94+
return permutation_index_ == other.permutation_index_;
9595
}
9696
};
9797

@@ -118,7 +118,7 @@ struct permutations_sized_adaptor
118118
std::iota(cycles.rbegin(), cycles.rend(), base_length - SubsequenceSize);
119119

120120
// return the cursor
121-
return {.indices_ = indices, .cycles_ = cycles, .index_ = 0};
121+
return {.indices_ = indices, .cycles_ = cycles, .permutation_index_ = 0};
122122
}
123123

124124
static constexpr auto last(self_t& self) -> cursor_type
@@ -138,20 +138,20 @@ struct permutations_sized_adaptor
138138
std::vector<std::size_t> cycles(SubsequenceSize, 0);
139139

140140
// return the cursor
141-
return {.indices_ = indices, .cycles_ = cycles, .index_ = self.count_permutations()};
141+
return {.indices_ = indices, .cycles_ = cycles, .permutation_index_ = self.count_permutations()};
142142
}
143143

144144
static constexpr auto is_last(self_t& self, const cursor_type& cursor) -> bool
145145
{
146-
return cursor.index_ >= self.count_permutations();
146+
return cursor.permutation_index_ >= self.count_permutations();
147147
}
148148

149149
static constexpr auto inc(self_t& self, cursor_type& cursor) -> void
150150
{
151151
const auto k = SubsequenceSize;
152152
const auto n = self.cache_.size();
153153

154-
cursor.index_ += 1;
154+
cursor.permutation_index_ += 1;
155155

156156
for (const auto i : flux::iota(std::size_t {0}, std::size_t {k}).reverse()) {
157157
if (cursor.cycles_[i] == 0) {

0 commit comments

Comments
 (0)