Skip to content

Small template simplifications #401

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

Merged
merged 1 commit into from
Sep 8, 2016

Conversation

jagerman
Copy link
Member

@jagerman jagerman commented Sep 8, 2016

The templates added in PR #372 and PR #385 overlap somewhat: both use predicate value counting, with independent implementations. This combines them by making count_t do the summation either with constexpr_sum or, under MSVC, a recursive template; the simplifies all_of_t and any_of_t to simply use count_t.

cc @dean0x7d for comments.

Switch count_t to use constexpr_sum (under non-MSVC), and then make
all_of_t/any_of_t use it instead of doing the sum itself.

For MSVC, count_t is still done using template recursion, but
all_of_t/any_of_t can also make use of it.
@dean0x7d
Copy link
Member

dean0x7d commented Sep 8, 2016

👍

@wjakob
Copy link
Member

wjakob commented Sep 8, 2016

nice!

@wjakob wjakob merged commit 356bf94 into pybind:master Sep 8, 2016
@jagerman jagerman deleted the templates-simplification branch September 9, 2016 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants