feat(kernel/environment): add for_each method for traversing environment declarations

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2014-05-20 10:15:28 -07:00
parent 9e55c8766f
commit 34a9c8304a
2 changed files with 7 additions and 0 deletions

View file

@ -167,4 +167,8 @@ environment environment::update(unsigned id, std::shared_ptr<environment_extensi
(*new_exts)[id] = ext;
return environment(m_header, m_id, m_definitions, m_global_levels, new_exts);
}
void environment::for_each(std::function<void(definition const & d)> const & f) const {
m_definitions.for_each([&](name const &, definition const & d) { return f(d); });
}
}

View file

@ -196,6 +196,9 @@ public:
is not pointer equal to the result.
*/
environment forget() const;
/** \brief Apply the function \c f to each definition */
void for_each(std::function<void(definition const & d)> const & f) const;
};
class name_generator;