-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make pqxx iterators model the right iterator category #846
Comments
I thought I did the work for this, sometime long ago. @alexolog do you know exactly which concepts are missing, and how I implement them? |
I think we should be able to get some of the information by trying to instantiate a template that expects a @alexolog did you see a helpful error like that while compiling your code? (Switching between gcc and clang may help — I think they produce different error messages. |
Looking at LegacyRandomAccessIterator, we can see the requirements:
It appears you have most of them, and the only one missing is |
See the example code I included in the original post. |
Implementing |
@alexolog for some reason I think some conversation disappeared. But you're right — I wasn't aware of the We'll probably need a deprecation period for the existing OTOH the row iterator is easy — that didn't have an
|
We should be able to resolve this together with #770. Rewrite the iterator types so that they're no longer closely intertwined with the row/field types; give |
Fixes: #846 This involves defining `operator[]` on the iterator, which indexes at an offset: `i[n] == *(i + n)`. Unfortunately I can't do the same for the _result_ iterator. Way back when, unaware of this requirement, I defined array indexing on a result iterator as `i[n] == (*i)[n]`. It made some code a lot more convenient and seemed very logical.
Fixes: #846 This involves defining `operator[]` on the iterator, which indexes at an offset: `i[n] == *(i + n)`. Unfortunately I can't do the same for the _result_ iterator. Way back when, unaware of this requirement, I defined array indexing on a result iterator as `i[n] == (*i)[n]`. It made some code a lot more convenient and seemed very logical.
Tempting: it now looks like a "divorce" between I tried commenting out the So loath as I am to break compatibility like this, I probably could implement (For now though, going with the demotion to |
When using C++20 concepts:
Results in:
Even though those iterators are "supposed" to model
std::random_access_iterator
The text was updated successfully, but these errors were encountered: