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

Short-circuit all_of/any_of/none_of instantiations #3093

Merged
merged 2 commits into from Jan 9, 2018

Conversation

K-ballo
Copy link
Member

@K-ballo K-ballo commented Jan 6, 2018

No description provided.

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

!all_of<pack_c<bool, !Vs...> >::value
!std::is_same<
pack_c<bool, Vs...>
, pack_c<bool, (Vs && false)...> // false...
Copy link
Member

Choose a reason for hiding this comment

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

Is this variant really better than what we previously had? If I read the code correctly, the second pack would always expand to pack_c<bool, false...>. Where is the benefit with this approach? I don't see any short circuiting happening here, what do I miss?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this variant is the same than what we previously had, any_of used to be implemented in terms of all_of and now it isn't anymore. These are the original interfaces, which later turned into specializations, and deal entirely with boolean constants: there are no instantiations to short-circuit. The base templates are the ones that now short-circuit instantiations.

That said, it's likely that those original interfaces are not being used anymore, and that it would be possible to remove them altogether.

@hkaiser hkaiser merged commit 4d672c8 into master Jan 9, 2018
@hkaiser hkaiser deleted the pack-short-circuit branch January 15, 2018 15:29
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

3 participants