1
0

change signature of path walk to allow differently typed generators.

This commit is contained in:
2020-01-08 20:27:46 -05:00
parent a988fb1bb9
commit 5a8c3af15a
2 changed files with 4 additions and 9 deletions

View File

@@ -7,7 +7,7 @@ int main() {
auto cube = tc::group::B(3);
auto vars = cube.solve();
auto words = vars.path.walk<std::string>(
auto words = vars.path.walk<std::string, std::string>(
"",
{"a", "b", "c"},
[](auto a, auto b) { return a + b; }
@@ -17,10 +17,5 @@ int main() {
std::cout << word << std::endl;
}
// for (size_t target = 1; target < vars.size(); target++) {
// auto &action = vars.path.get(target);
// std::cout << action.from_idx << " * " << action.gen << " = " << target << std::endl;
// }
return 0;
}

View File

@@ -30,11 +30,11 @@ namespace tc {
void put(int from_idx, int gen, int to_idx);
template<class T>
template<class T, class E>
[[nodiscard]] std::vector<T> walk(
T start,
std::vector<T> gens,
std::function<T(const T &, const T &)> op
std::vector<E> gens,
std::function<T(const T &, const E &)> op
) const {
std::vector<T> res(size());
res[0] = start;