- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 198
 
Re-order apply_scalar_binary signature to pass functor first #3156
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
Conversation
          
 Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang:  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- if you're on a consistency kick, apply_vector_unary is also "backwards"
| inline auto apply_scalar_binary(F&& f, T1&& x, T2&& y) { | ||
| check_matching_sizes("Binary function", "x", x, "y", y); | ||
| return make_holder( | ||
| [](auto& f_inner, auto& x_inner, auto& y_inner) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(side note / different PR) these could be auto&& and when you call f and then you can do std::forward<decltype(x_inner)>(x_inner) etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good shout, will work up a PR
          
 Classic past-me making more work for future-me. Thanks will sort!  | 
    
Summary
The signature for
apply_scalar_binarycurrently takes the functor as its last argument (i.e.,apply_scalar_binary(x, y, f)) which is a bit of a non-standard pattern and isn't consistent withapply_scalar_ternaryThis PR updates the signatures and function usage for
apply_scalar_binaryto take the binary functor as its first argumentTests
N/A - Current tests should still pass
Side Effects
N/A
Release notes
Updated signature for
apply_scalar_binaryto take the functor as its first argument, instead of the lastChecklist
Copyright holder: Andrew Johnson
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit)make test-headers)make test-math-dependencies)make doxygen)make cpplint)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested