rename input/output
This commit is contained in:
@@ -9,11 +9,11 @@
|
||||
namespace intcode {
|
||||
|
||||
struct Input {
|
||||
ValueType &pos;
|
||||
ValueType &input;
|
||||
};
|
||||
|
||||
struct Output {
|
||||
ValueType val;
|
||||
ValueType output;
|
||||
};
|
||||
|
||||
struct Halt {};
|
||||
@@ -32,8 +32,8 @@ template <std::invocable<ValueType&> Fin, std::invocable<ValueType> Fout, std::i
|
||||
auto Advance(Machine & machine, Fin input, Fout output, Fhalt halt) {
|
||||
return std::visit(overloaded{
|
||||
[&](Halt) { return halt(); },
|
||||
[&](Input i) { return input(i.pos); },
|
||||
[&](Output o) { return output(o.val); },
|
||||
[&](Input i) { return input(i.input); },
|
||||
[&](Output o) { return output(o.output); },
|
||||
}, Step(machine));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user