allow iterators with different RV policies (fixes #388)
diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h
index b35b2fc..7bdf913 100644
--- a/include/pybind11/pybind11.h
+++ b/include/pybind11/pybind11.h
@@ -1123,7 +1123,7 @@
     keep_alive_impl(nurse, patient);
 }
 
-template <typename Iterator, typename Sentinel, bool KeyIterator = false>
+template <typename Iterator, typename Sentinel, bool KeyIterator, typename... Extra>
 struct iterator_state {
     Iterator it;
     Sentinel end;
@@ -1139,10 +1139,10 @@
           typename ValueType = decltype(*std::declval<Iterator>()),
           typename... Extra>
 iterator make_iterator(Iterator first, Sentinel last, Extra &&... extra) {
-    typedef detail::iterator_state<Iterator, Sentinel> state;
+    typedef detail::iterator_state<Iterator, Sentinel, false, Extra...> state;
 
     if (!detail::get_type_info(typeid(state))) {
-        class_<state>(handle(), "")
+        class_<state>(handle(), "iterator")
             .def("__iter__", [](state &s) -> state& { return s; })
             .def("__next__", [](state &s) -> ValueType {
                 if (!s.first)
@@ -1157,15 +1157,16 @@
 
     return (iterator) cast(state { first, last, true });
 }
+
 template <typename Iterator,
           typename Sentinel,
           typename KeyType = decltype((*std::declval<Iterator>()).first),
           typename... Extra>
 iterator make_key_iterator(Iterator first, Sentinel last, Extra &&... extra) {
-    typedef detail::iterator_state<Iterator, Sentinel, true> state;
+    typedef detail::iterator_state<Iterator, Sentinel, true, Extra...> state;
 
     if (!detail::get_type_info(typeid(state))) {
-        class_<state>(handle(), "")
+        class_<state>(handle(), "iterator")
             .def("__iter__", [](state &s) -> state& { return s; })
             .def("__next__", [](state &s) -> KeyType {
                 if (!s.first)