Hi, I've been looking into libcpp container definitions and found that they are kind of messy, in particular, iterators are defined as nested classes for every container.
This leads to code duplication, and for certain containers some overloaded methods seem to be missing or conversely declared, but not provided. I was trying to have a stab at cleaning this up and offering patches, but I'm confused as to how to proceed. At first, I thought that I could turn concepts into a hierarchy of inherited classes in `iterator.pxd` like _ForwardIterator -> _BidirectionalIterator -> _RandomAccessIterator and inherit container iterators from those classes. It seems that this is a bad idea for several reasons: 1) Apparently, there are some problems with inheritance, overload resolution and type deduction, e.g. such that Cython deduces `_RandomAccessIterator` as a result type for a + operation instead of `vector[int].iterator` (which inherits from _RandomAccessIterator). 2) Cython thinks these are real classes and uses them in explicit template arguments in generated C++ code. The combination of (1) and (2) causes a lot of fail. The only other possibility that crossed my mind so far was to use the old "include" for code reuse and create files like _RandomAccessIterator.pxi, _RandomAccessIteratorConst.pxi, etc. and include their contents in the container definitions. Sounds terrible, and I guess this wouldn't get merged, even if I get that to work. Now, are there better approaches that I've overlooked? -- Sincerely yours, Yury V. Zaytsev _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel