Created
May 19, 2015 14:26
-
-
Save maxtruxa/2bd4aa6b0ddc8d204cc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename TMapIterator> | |
class key_iterator : public TMapIterator | |
{ | |
public: | |
typedef typename TMapIterator::value_type::first_type key_type; | |
key_iterator() : TMapIterator() { } | |
key_iterator(TMapIterator iter) : TMapIterator(iter) { } | |
key_type* operator->() | |
{ | |
return &this->TMapIterator::operator->()->first; | |
} | |
key_type& operator*() | |
{ | |
return this->TMapIterator::operator*().first; | |
} | |
}; | |
template<typename TMapIterator> | |
key_iterator<TMapIterator> make_key_iterator(TMapIterator iter) | |
{ | |
return key_iterator<TMapIterator>(iter); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment