Add missing unary plus and cleanup tests#2032
Conversation
| * @return result of unary plus of the input. | ||
| */ | ||
| template <typename T> | ||
| inline plain_type_t<T> plus(const T& x) { |
There was a problem hiding this comment.
Use perfect forwarding when returning the argument.
There was a problem hiding this comment.
Like this?
template <typename T>
inline plain_type_t<T> plus(T&& x) {
return std::forward(x);
}There was a problem hiding this comment.
Yes, also make the return type T - we don't need plus to eval its argument.
|
@serban-nicusor-toptal can we try if If there is an issue with the machine, we can see if we can fix it. |
|
Hey @rok-cesnovar the pool was enough, there were no issues with it not being able to find machines. |
|
@serban-nicusor-toptal thanks! |
Jenkins Console Log Machine informationProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010CPU: G++: Clang: |
Summary
Fixes #1888 by adding the unary plus. When adding tests for that I saw that we still have the _works_with_other_functions tests that are redundant after #1980 This advances #1886 but does not close it yet.
Tests
Added same tests as for minus()
Side Effects
/
Release notes
Added missing implementations for the unary plus.
Checklist
Math issue No implementation of plus(x) #1888
Copyright holder: Rok Češnovar, Univ. of Ljubljana
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