Listing 3: Dereference adaptor.
template <typename StoredIterator, class Compare> class dereference { public: typedef StoredIterator first_argument_type; typedef StoredIterator second_argument_type; typedef typename Compare::result_type result_type; dereference(const Compare &comp = Compare()) : comp_(comp) {} result_type operator()(first_argument_type first, second_argument_type second) { return comp_(*first, *second); } private: Compare comp_; };