Skip to content

Commit

Permalink
generator::to_vec
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Jul 21, 2024
1 parent 3fe4f20 commit a778940
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/utl/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ struct generator {
return std::move(h_.promise().value_);
}

std::vector<T> to_vec() {
auto v = std::vector<T>{};
while ((*this)) {
v.emplace_back((*this)());
}
return v;
}

private:
void fill() {
if (!full_) {
Expand Down

0 comments on commit a778940

Please sign in to comment.