Skip to content

Commit 4847e65

Browse files
committed
up
1 parent 197d441 commit 4847e65

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

example/coro/example_stm.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// Created by konstantin on 27.07.24.
33
//
44

5+
#include <any>
56
#include <cassert>
7+
#include <concepts>
68
#include <coroutine>
79
#include <iostream>
810
#include <unordered_map>
9-
#include <concepts>
10-
#include <any>
1111

1212
#include "generator.h"
1313

@@ -86,24 +86,24 @@ Generator<Sym> input_seq(std::string seq) {
8686
}
8787
}
8888

89-
template <typename F, typename SM>
90-
struct stm_awaiter : public F {
89+
template <typename TableTransition, typename SM>
90+
struct stm_awaiter : public TableTransition {
9191
SM& stm;
92-
stm_awaiter(F f, SM& stm) : F(f), stm(stm) {}
92+
stm_awaiter(TableTransition transition, SM& stm)
93+
: TableTransition(transition), stm(stm) {}
9394

9495
bool await_ready() const noexcept { return false; }
9596
coro_t await_suspend(std::coroutine_handle<>) noexcept {
9697
stm.gennext();
9798
auto sym = stm.genval();
98-
auto new_state = F::operator()(sym);
99+
auto new_state = TableTransition::operator()(sym);
99100
return stm[new_state];
100101
}
101102
[[nodiscard]] bool await_resume() const noexcept {
102103
return stm.genval() == Sym::Term;
103104
}
104105
};
105106

106-
107107
template <class State, class Sym>
108108
class StateMachine final {
109109
public:

0 commit comments

Comments
 (0)