Don't require operator-> for key iterators

This commit is contained in:
Ivan Smirnov 2016-08-24 23:27:19 +01:00
parent b692896fc7
commit c5a1c8a6b9

View File

@ -1149,7 +1149,7 @@ iterator make_iterator(Iterator first, Iterator last, Extra &&... extra) {
return (iterator) cast(state { first, last, true }); return (iterator) cast(state { first, last, true });
} }
template <typename Iterator, template <typename Iterator,
typename KeyType = decltype(std::declval<Iterator>()->first), typename KeyType = decltype((*std::declval<Iterator>()).first),
typename... Extra> typename... Extra>
iterator make_key_iterator(Iterator first, Iterator last, Extra &&... extra) { iterator make_key_iterator(Iterator first, Iterator last, Extra &&... extra) {
typedef detail::iterator_state<Iterator, true> state; typedef detail::iterator_state<Iterator, true> state;
@ -1164,7 +1164,7 @@ iterator make_key_iterator(Iterator first, Iterator last, Extra &&... extra) {
s.first = false; s.first = false;
if (s.it == s.end) if (s.it == s.end)
throw stop_iteration(); throw stop_iteration();
return s.it->first; return (*s.it).first;
}, return_value_policy::reference_internal, std::forward<Extra>(extra)...); }, return_value_policy::reference_internal, std::forward<Extra>(extra)...);
} }