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 class template argument deduction guides for distributions #756

Merged
merged 5 commits into from
Feb 12, 2022

Conversation

jamesfolberth
Copy link
Contributor

Fixes #754 by adding deduction guides for the case where the class template arguments are not given explicitly.
Follows the demonstration by @jzmaddock.

I didn't put in static_assert for silly cases, e.g., where the user writes chi_squared_distribution<int>.
If that's what they write, so be it.

@jamesfolberth
Copy link
Contributor Author

Putzing around in Godbolt, it looks like GCC-8 supports pre-final C++17 deduction guides (__cpp_deduction_guides==201611) and variadic templates, but they're not playing together well in test_dist_deduction_guides.cpp. Manually providing an overload of test_deduction_guide for the no arg case should hopefully do the trick.

@jamesfolberth
Copy link
Contributor Author

I'm not sure what's going on with naive_monte_carlo_test (case 5?) failing during the CI run ...

@jamesfolberth
Copy link
Contributor Author

Well, clang 6-8 are now unhappy with the "no arg" case. These use the default template arg, not the deduction guide, right? So I think we can just get rid of those tests.

I believe I've got some of the CI running locally, and removing the "no arg" tests seems to be working.

@mborland
Copy link
Member

mborland commented Feb 8, 2022

@jamesfolberth I approved your PR to run against our CI so you should start seeing results.

Edit: You don't need to add the platform tags unless there is one specific one you need. The system can't process multiple tags so the default is run everything.

…g#754

GCC-8 and clang 6-8 were unhappy with the no-arg cases, which use the
default template arg, not the deduction guide, anyway.
@jamesfolberth
Copy link
Contributor Author

Whoops! That broke it, sorry. I was trying to avoid MSVC, which appeared to me to be failing over the weekend for reasons unrelated to this PR. I'll remove those tags from the commit message. Thanks for your help!

@mborland
Copy link
Member

This PR looks good to me. Do you have anything else to add, and does it solve your problem?

@NAThompson
Copy link
Collaborator

Looks good to me as well. Might want to let @jzmaddock weigh in though; I've pwned myself with argument deduction subtleties before . . .

@jamesfolberth
Copy link
Contributor Author

jamesfolberth commented Feb 10, 2022 via email

@jzmaddock
Copy link
Collaborator

Other than the single comment on the fisher_f this looks good to go to me - many thanks to @jamesfolberth for seeing this through!

@jamesfolberth
Copy link
Contributor Author

Oh dang nice catch! Thanks all for the help. Happy to contribute!

@jamesfolberth
Copy link
Contributor Author

FWIW looks like CI is failing waiting on a runner.

@jzmaddock
Copy link
Collaborator

Ugh, that's just silly. Anyone any objections to merging anyway? All looks good to me.

@ckormanyos
Copy link
Member

I've had the runner farm go on strike a few times. I'm not exactly sure what causes that. Short of stopping and restarting the entire run on GHA that run is toasted. So unless we restart entirely, which seems uwaranted, content gets the nod.

@jamesfolberth
Copy link
Contributor Author

I think we're safe, so I've no problem with merging anyway.

After my 3rd commit (6bd06cf) I ran locally test_dist_deduction_guides with all the compilers and language versions for ubuntu-focal and ubuntu-bionic. Given that that passed and that CI ran on my 2nd commit, I think we're in the clear.

@NAThompson NAThompson merged commit 01a938c into boostorg:develop Feb 12, 2022
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.

Unexpected instantiation of chi_squared_distribution in C++17
5 participants