feature: double -> const auto when static_cast in right

</subject>

Branch: devel

<type>:
- [ ] Bug fix
- [ ] Bug fix (Test)
- [x] New feature
- [ ] Breaking change
- [ ] Documentation update
- [ ] This change requires a documentation update

<body>

<footer>

Signed-off-by: Certseeds <51754303+Certseeds@users.noreply.github.com>
This commit is contained in:
Certseeds 2022-02-02 12:11:52 +08:00 committed by Martin Hořeňovský
parent efb54926ee
commit 9afb6ce138

View File

@ -86,14 +86,14 @@ namespace Catch {
template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>
Approx& epsilon( T const& newEpsilon ) { Approx& epsilon( T const& newEpsilon ) {
double epsilonAsDouble = static_cast<double>(newEpsilon); const auto epsilonAsDouble = static_cast<double>(newEpsilon);
setEpsilon(epsilonAsDouble); setEpsilon(epsilonAsDouble);
return *this; return *this;
} }
template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>> template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>
Approx& margin( T const& newMargin ) { Approx& margin( T const& newMargin ) {
double marginAsDouble = static_cast<double>(newMargin); const auto marginAsDouble = static_cast<double>(newMargin);
setMargin(marginAsDouble); setMargin(marginAsDouble);
return *this; return *this;
} }