From ae077e741984b292785674ad61800bc82bc007ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Thu, 18 Jul 2024 11:57:15 +0200
Subject: [PATCH] C++20 modernization: use std::ranges::any_of

---
 mex/sources/bytecode/bytecode.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index 08942f165e..b19188dc91 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -272,9 +272,11 @@ mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
       double* constrained_pf = mxGetPr(constrained_perfect_foresight_);
       double* shock_pf = mxGetPr(shock_perfect_foresight_);
       if (auto is_pf = [](double v) { return v != 0; };
-          any_of(constrained_pf,
-                 constrained_pf + mxGetNumberOfElements(constrained_perfect_foresight_), is_pf)
-          || any_of(shock_pf, shock_pf + mxGetNumberOfElements(shock_perfect_foresight_), is_pf))
+          ranges::any_of(constrained_pf,
+                         constrained_pf + mxGetNumberOfElements(constrained_perfect_foresight_),
+                         is_pf)
+          || ranges::any_of(shock_pf, shock_pf + mxGetNumberOfElements(shock_perfect_foresight_),
+                            is_pf))
         mexErrMsgTxt(
             "Shocks of type 'perfect_foresight' are not supported with the bytecode option.");
 
-- 
GitLab