From d295fa1561b60ca3541fa00fece74036a8cb5f18 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Tue, 25 Jun 2024 23:53:36 -0700 Subject: [PATCH] Use requires expression for callback constraints --- .../sleipnir/optimization/OptimizationProblem.hpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/include/sleipnir/optimization/OptimizationProblem.hpp b/include/sleipnir/optimization/OptimizationProblem.hpp index 9df25605..7d387e02 100644 --- a/include/sleipnir/optimization/OptimizationProblem.hpp +++ b/include/sleipnir/optimization/OptimizationProblem.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -330,9 +329,9 @@ class SLEIPNIR_DLLEXPORT OptimizationProblem { * @param callback The callback. */ template - requires std::invocable && - std::same_as, - void> + requires requires(F callback, const SolverIterationInfo& info) { + { callback(info) } -> std::same_as; + } void Callback(F&& callback) { m_callback = [=, callback = std::forward(callback)]( const SolverIterationInfo& info) { @@ -350,9 +349,9 @@ class SLEIPNIR_DLLEXPORT OptimizationProblem { * solver to exit early with the solution it has so far. */ template - requires std::invocable && - std::same_as, - bool> + requires requires(F callback, const SolverIterationInfo& info) { + { callback(info) } -> std::same_as; + } void Callback(F&& callback) { m_callback = std::forward(callback); }