diff --git a/cxxmph/iterator_first.h b/cxxmph/iterator_first.h new file mode 100644 index 0000000..d8350af --- /dev/null +++ b/cxxmph/iterator_first.h @@ -0,0 +1,12 @@ +template +struct iterator_first : public iterator { + iterator_first(iterator it) : iterator(it) { } + const typename iterator::value_type::first_type& operator*() const { + return this->iterator::operator*().first; + } +}; + +template +iterator_first make_iterator_first(iterator it) { + return iterator_first(it); +}