remove constness of Pair
optional: make conversion to bool explicit
filter: evaluate filter function after comparing iterators
fix missing casts