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

IsEmpty() should check for .empty(), not .size() == 0 #14

Closed
nabijaczleweli opened this issue Oct 12, 2015 · 7 comments
Closed

IsEmpty() should check for .empty(), not .size() == 0 #14

nabijaczleweli opened this issue Oct 12, 2015 · 7 comments
Labels
Milestone

Comments

@nabijaczleweli
Copy link
Contributor

No description provided.

@nabijaczleweli
Copy link
Contributor Author

Any update on this?

@joakimkarlsson
Copy link
Collaborator

Thanks for reporting!

Is there a practical consequence to this?

@nabijaczleweli
Copy link
Contributor Author

Yes, inability to check for "emptiness" of things that are not containers (custom smart pointers or wrappers, for example).

@joakimkarlsson
Copy link
Collaborator

Yes, that makes sense. Thanks.

Right now, IsEmpty() is implemented as a special case of HasLength(). We need to promote IsEmpty() to using its own IsEmptyConstraint.

@nabijaczleweli
Copy link
Contributor Author

Any update on this?

@sbeyer sbeyer added the bug label Feb 4, 2017
@sbeyer sbeyer added this to the 3.0 Release milestone Feb 4, 2017
@sbeyer
Copy link
Member

sbeyer commented Feb 5, 2017

I just looked into it in the hope that it would be simple.

For example, C++11's std::forward_list has no size() method. I included it in sequence_container_tests.cpp and noticed that a lot more than isEmpty() uses the size() method, for example, also the All operator does. Interestingly, also the so-far compiling tests fail on std::forward_list... Very weird. I pushed the work in progress to the more-container-tests branch, if interested, but I am not going to work on it now.

sbeyer added a commit that referenced this issue Apr 6, 2017
This way, IsEmpty() can be used for, for example, std::forward_list
which does not have a size() method.

Fixes #14.
@sbeyer
Copy link
Member

sbeyer commented Apr 6, 2017

Update: The before-mentioned branch is already merged and deleted; it contained only preliminary work. I am now working on the issue in the issue-14 branch.

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

No branches or pull requests

3 participants