Skip to content
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

add cbegin/cend/crbegin/crend #4530

Merged
merged 4 commits into from
Apr 15, 2022
Merged

add cbegin/cend/crbegin/crend #4530

merged 4 commits into from
Apr 15, 2022

Conversation

maxbachmann
Copy link
Contributor

No description provided.

@scoder scoder added this to the 3.0 milestone Dec 28, 2021
@scoder
Copy link
Contributor

scoder commented Dec 28, 2021

Thanks. Could you please add a couple of tests for these? If things get better with const handling, then we should have a way to make sure we don't regress.

@maxbachmann
Copy link
Contributor Author

Could you please add a couple of tests for these? If things get better with const handling, then we should have a way to make sure we don't regress.

The main part of this is #4528 which tests that const_iterator can not be converted to iterator, but iterator can be converted to const_iterator. Is there anything in particular you would like to have tested for these new functions? All I can think of, is a test, to check whether they return a const_iterator.

@scoder
Copy link
Contributor

scoder commented Dec 28, 2021

It's always good to have at least a tiny bit of actual runtime validated usage of our declarations. It's nice to know that Cython allows the right declarations and rejects incorrect usage, but as long as we haven't generated any code for their correct usage and seen the C++ compiler generate a correct program from it, we can't really be sure that they work the way users should be using them, and that their behaviour survives future changes.

@jjerphan
Copy link
Contributor

Hello @maxbachmann, do you still have time to work on this PR?

If it is not the case, I am interested in pursuing it.

@maxbachmann
Copy link
Contributor Author

do you still have time to work on this PR?

I should be able to write some tests for this PR this week. I hoped to get the iterator fix from #4528 in first.

@maxbachmann
Copy link
Contributor Author

It's always good to have at least a tiny bit of actual runtime validated usage of our declarations

@scoder I added similar tests to the ones existing for the begin/end api of the corresponding classes. The CI error appears to exist on master as well.

Copy link
Contributor

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment.

Cython/Includes/libcpp/string.pxd Outdated Show resolved Hide resolved
@jjerphan
Copy link
Contributor

I also think that the failures are unrelated to the changes made here.

@maxbachmann
Copy link
Contributor Author

maxbachmann commented Apr 13, 2022

At least part of the CI failures was caused by the missing definitions of cebgin/cend/crbegin/crend for multimap/unordered_multimap/multiset/unordered_multiset, which also shows that the tests are not entirely useless ;)

@scoder
Copy link
Contributor

scoder commented Apr 15, 2022

Thanks

@scoder scoder merged commit 57582f6 into cython:master Apr 15, 2022
@maxbachmann
Copy link
Contributor Author

@scoder I placed these tests in the normal test files. Is this correct, since cbegin/cend only exist since C++11.

@da-woods
Copy link
Contributor

@scoder I placed these tests in the normal test files. Is this correct, since cbegin/cend only exist since C++11.

No, really they should be in files tagged with cpp11

@maxbachmann
Copy link
Contributor Author

I will open a PR moving them into a cpp11 file 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants