Commit 89930b8d authored by Paul's avatar Paul
Browse files

Add missing header

parent 81eca52d
#ifndef RTG_GUARD_ERASE_HPP
#define RTG_GUARD_ERASE_HPP
namespace rtg {
template<class R, class T>
auto erase(R&& r, const T& value)
{
return r.erase(std::remove(r.begin(), r.end(), value), r.end());
}
template<class R, class P>
auto erase_if(R&& r, P&& pred)
{
return r.erase(std::remove_if(r.begin(), r.end(), pred), r.end());
}
} // namespace rtg
#endif
......@@ -35,14 +35,13 @@ struct instruction
if(r != result)
{
result = r;
for(auto&& ins:output)
for(auto&& ins : output)
{
ins->replace(compute_shape(ins->op, ins->arguments));
}
}
}
void replace(std::vector<instruction_ref> args)
{
clear_arguments();
......@@ -51,7 +50,7 @@ struct instruction
void clear_arguments()
{
for(auto&& arg:arguments)
for(auto&& arg : arguments)
{
rtg::erase(arg->output, *this);
}
......@@ -62,20 +61,11 @@ struct instruction
return std::addressof(i) == std::addressof(*ref);
}
friend bool operator==(instruction_ref ref, const instruction& i)
{
return i == ref;
}
friend bool operator==(instruction_ref ref, const instruction& i) { return i == ref; }
friend bool operator!=(const instruction& i, instruction_ref ref)
{
return !(i == ref);
}
friend bool operator!=(const instruction& i, instruction_ref ref) { return !(i == ref); }
friend bool operator!=(instruction_ref ref, const instruction& i)
{
return !(i == ref);
}
friend bool operator!=(instruction_ref ref, const instruction& i) { return !(i == ref); }
operation op;
shape result;
......
......@@ -47,7 +47,6 @@ program::replace_instruction(instruction_ref ins, operation op, std::vector<inst
ins->replace(op, r, args);
backreference(ins);
return ins;
}
instruction_ref program::add_literal(literal l)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment