forked from mirror/toddcox-faster
change signature of path walk to allow differently typed generators.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user