Updating old idioms
Using bronto::rewrite_expr to update old idioms to newer ones.
In C++20, std::set added a contains method to replace the clunky find(...) != end() idiom. Here's how you can use Bronto to update your entire code base:
Write the following rule.
struct UpdateFindToContains : bronto::rewrite_expr {
template <typename Set, typename Key>
BRONTO_BEFORE()
bool before(Set s, Key k) { return s.find(k) != s.end(); }
template <typename Set, typename Key>
BRONTO_AFTER()
bool after(Set s, Key k) { return s.contains(k); }
};Sit back while Bronto modernizes your codebase.
Once all the existing uses have been updated, you could remove the rule above, but you can also leave it in so that any new code using the old idiom will automatically be updated as well!
See it in action on Compiler Explorer.