1
Fork 0

Added iterator first.

This commit is contained in:
Davi de Castro Reis 2010-11-04 22:57:41 -02:00
parent 7ead7bff2f
commit 76a88922ac
1 changed files with 12 additions and 0 deletions

12
cxxmph/iterator_first.h Normal file
View File

@ -0,0 +1,12 @@
template <typename iterator>
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 <typename iterator>
iterator_first<iterator> make_iterator_first(iterator it) {
return iterator_first<iterator>(it);
}