From 76a88922acfa0342af8c8b08435b6cefa6abdd50 Mon Sep 17 00:00:00 2001 From: Davi de Castro Reis Date: Thu, 4 Nov 2010 22:57:41 -0200 Subject: [PATCH] Added iterator first. --- cxxmph/iterator_first.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cxxmph/iterator_first.h 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); +}