Improve list iterator

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-08-17 11:31:36 -07:00
parent a6f36ba546
commit 6edae938b7
2 changed files with 2 additions and 1 deletions

View file

@ -303,7 +303,7 @@ class pp_fn {
auto it = parts.begin();
for (unsigned i = 1; i < num_args(e); i++) {
result p_arg = pp_mixfix_child(op, arg(e, i), depth);
unsigned sz = (*it).size();
unsigned sz = it->size();
r_format += format{format(*it), nest(sz+1, format{line(), p_arg.first})};
r_depth = std::max(r_depth, p_arg.second);
++it;

View file

@ -82,6 +82,7 @@ public:
bool operator==(iterator const & s) const { return m_it == s.m_it; }
bool operator!=(iterator const & s) const { return !operator==(s); }
T const & operator*() { lean_assert(m_it); return m_it->m_head; }
T const * operator->() { lean_assert(m_it); return &(m_it->m_head); }
};
iterator begin() const { return iterator(m_ptr); }