We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1796c0 commit eb3e237Copy full SHA for eb3e237
1 file changed
test/iterator.cpp
@@ -38,6 +38,12 @@ int back(list_int& x)
38
39
typedef std::pair<list_int::iterator,list_int::iterator> list_range;
40
41
+struct list_range2 : list_range
42
+{
43
+ list_int::iterator& begin() { return this->first; }
44
+ list_int::iterator& end() { return this->second; }
45
+};
46
+
47
list_range range(list_int& x)
48
{
49
return list_range(x.begin(), x.end());
@@ -88,6 +94,12 @@ BOOST_PYTHON_MODULE_INIT(iterator_ext)
88
94
, range(&list_range::first, &list_range::second))
89
95
;
90
96
97
+ class_<list_range2>("list_range2")
98
99
+ // We can specify member functions returning a non-const reference
100
+ .def("__iter__", range(&list_range2::begin, &list_range2::end))
101
+ ;
102
91
103
class_<two_lists>("two_lists")
92
104
93
105
// We can spcify member functions
0 commit comments