Minor cleanup to 6110fb5

This commit is contained in:
Charles Dang 2017-08-08 01:41:17 +11:00
parent 7b85d7b113
commit 9c15e54baf

View file

@ -1494,16 +1494,12 @@ void canvas::parse_cfg(const config& cfg)
void canvas::clear_shapes(const bool force)
{
auto iter = std::remove_if(shapes_.begin(), shapes_.end(), [force](const shape_ptr s)
{
return !s->immutable() && !force;
});
auto conditional = [force](const shape_ptr s)->bool { return !s->immutable() && !force; };
auto iter = std::remove_if(shapes_.begin(), shapes_.end(), conditional);
shapes_.erase(iter, shapes_.end());
iter = std::remove_if(drawn_shapes_.begin(), drawn_shapes_.end(), [force](const shape_ptr s)
{
return !s->immutable() && !force;
});
iter = std::remove_if(drawn_shapes_.begin(), drawn_shapes_.end(), conditional);
drawn_shapes_.erase(iter, drawn_shapes_.end());
}