Skip to content
Snippets Groups Projects
Commit b5bda6da authored by Timo Koch's avatar Timo Koch
Browse files

Merge branch 'cleanup/use-c++17-is-invokable' into 'master'

Cleanup/use c++17 is invokable

See merge request !1917
parents 8363a935 a399339a
No related branches found
No related tags found
1 merge request!1917Cleanup/use c++17 is invokable
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <type_traits>
#include <dune/common/std/type_traits.hh>
#include <dumux/common/doubleexpintegrationconstants.hh> #include <dumux/common/doubleexpintegrationconstants.hh>
namespace Dumux { namespace Dumux {
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
* \return The value of the integral * \return The value of the integral
*/ */
template<class Function, template<class Function,
typename std::enable_if_t<Dune::Std::is_invocable<Function, Scalar>::value>...> typename std::enable_if_t<std::is_invocable_r_v<Scalar, Function, Scalar>>...>
static Scalar integrate(const Function& f, static Scalar integrate(const Function& f,
const Scalar a, const Scalar a,
const Scalar b, const Scalar b,
...@@ -107,7 +107,7 @@ public: ...@@ -107,7 +107,7 @@ public:
* \return The value of the integral. * \return The value of the integral.
*/ */
template<class Function, template<class Function,
typename std::enable_if_t<Dune::Std::is_invocable<Function, Scalar>::value>...> typename std::enable_if_t<std::is_invocable_r_v<Scalar, Function, Scalar>>...>
static Scalar integrate(const Function& f, static Scalar integrate(const Function& f,
const Scalar a, const Scalar a,
const Scalar b, const Scalar b,
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
#include <dune/geometry/quadraturerules.hh> #include <dune/geometry/quadraturerules.hh>
#include <dune/common/concept.hh> #include <dune/common/concept.hh>
#include <dune/common/std/type_traits.hh>
#if HAVE_DUNE_FUNCTIONS #if HAVE_DUNE_FUNCTIONS
#include <dune/functions/gridfunctions/gridfunction.hh> #include <dune/functions/gridfunctions/gridfunction.hh>
...@@ -262,7 +261,7 @@ auto integrateL2Error(const GridView& gv, ...@@ -262,7 +261,7 @@ auto integrateL2Error(const GridView& gv,
* \return The value of the integral * \return The value of the integral
*/ */
template<class Scalar, class Function, template<class Scalar, class Function,
typename std::enable_if_t<Dune::Std::is_invocable<Function, Scalar>::value>...> typename std::enable_if_t<std::is_invocable_r_v<Scalar, Function, Scalar>>...>
Scalar integrateScalarFunction(const Function& f, Scalar integrateScalarFunction(const Function& f,
const Scalar lowerBound, const Scalar lowerBound,
const Scalar upperBound, const Scalar upperBound,
......
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <type_traits>
#include <dune/common/std/type_traits.hh>
#include <dumux/common/exceptions.hh> #include <dumux/common/exceptions.hh>
#include <dumux/common/parameters.hh> #include <dumux/common/parameters.hh>
...@@ -43,11 +42,10 @@ namespace Dumux { ...@@ -43,11 +42,10 @@ namespace Dumux {
* \param derivative Derivative of the residual * \param derivative Derivative of the residual
* \param tol Relative shift tolerance * \param tol Relative shift tolerance
* \param maxIter Maximum number of iterations * \param maxIter Maximum number of iterations
* \todo replace std::result_of by std::invoke_result for C++17
*/ */
template<class Scalar, class ResFunc, class DerivFunc, template<class Scalar, class ResFunc, class DerivFunc,
typename std::enable_if_t<Dune::Std::is_invocable<ResFunc, Scalar>::value && typename std::enable_if_t<std::is_invocable_r_v<Scalar, ResFunc, Scalar> &&
Dune::Std::is_invocable<DerivFunc, Scalar>::value>...> std::is_invocable_r_v<Scalar, DerivFunc, Scalar>>...>
Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, const DerivFunc& derivative, Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, const DerivFunc& derivative,
const Scalar tol = 1e-13, const int maxIter = 200) const Scalar tol = 1e-13, const int maxIter = 200)
{ {
...@@ -87,7 +85,7 @@ Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, const DerivFun ...@@ -87,7 +85,7 @@ Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, const DerivFun
* \param maxIter Maximum number of iterations * \param maxIter Maximum number of iterations
*/ */
template<class Scalar, class ResFunc, template<class Scalar, class ResFunc,
typename std::enable_if_t<Dune::Std::is_invocable<ResFunc, Scalar>::value>...> typename std::enable_if_t<std::is_invocable_r_v<Scalar, ResFunc, Scalar>>...>
Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual,
const Scalar tol = 1e-13, const int maxIter = 200) const Scalar tol = 1e-13, const int maxIter = 200)
{ {
...@@ -109,7 +107,7 @@ Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual, ...@@ -109,7 +107,7 @@ Scalar findScalarRootNewton(Scalar xOld, const ResFunc& residual,
* \param maxIter Maximum number of iterations * \param maxIter Maximum number of iterations
*/ */
template<class Scalar, class ResFunc, template<class Scalar, class ResFunc,
typename std::enable_if_t<Dune::Std::is_invocable<ResFunc, Scalar>::value>...> typename std::enable_if_t<std::is_invocable_r_v<Scalar, ResFunc, Scalar>>...>
Scalar findScalarRootBrent(Scalar a, Scalar b, const ResFunc& residual, Scalar findScalarRootBrent(Scalar a, Scalar b, const ResFunc& residual,
const Scalar tol = 1e-13, const int maxIter = 200) const Scalar tol = 1e-13, const int maxIter = 200)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment