From c614caca11066c3eedc46917e91e5b3424b2ea08 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Fri, 19 Jul 2024 12:22:35 +0200
Subject: [PATCH] C++20 modernization: use std::ranges::copy

---
 mex/sources/bytecode/bytecode.cc         | 2 +-
 mex/sources/libkorder/tl/int_sequence.hh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index b19188dc91..e3c244ab96 100644
--- a/mex/sources/bytecode/bytecode.cc
+++ b/mex/sources/bytecode/bytecode.cc
@@ -579,7 +579,7 @@ mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[])
         {
           vector<double> residual = interprete.get_residual();
           plhs[0] = mxCreateDoubleMatrix(residual.size() / periods, periods, mxREAL);
-          std::copy(residual.begin(), residual.end(), mxGetPr(plhs[0]));
+          std::ranges::copy(residual, mxGetPr(plhs[0]));
         }
       else
         {
diff --git a/mex/sources/libkorder/tl/int_sequence.hh b/mex/sources/libkorder/tl/int_sequence.hh
index 2a2e066158..1ae4a575d8 100644
--- a/mex/sources/libkorder/tl/int_sequence.hh
+++ b/mex/sources/libkorder/tl/int_sequence.hh
@@ -79,7 +79,7 @@ public:
   IntSequence(std::initializer_list<int> init) :
       data {new int[init.size()]}, length {static_cast<int>(init.size())}
   {
-    std::copy(init.begin(), init.end(), data);
+    std::ranges::copy(init, data);
   }
   // Copy constructor
   IntSequence(const IntSequence& s) : data {new int[s.length]}, length {s.length}
-- 
GitLab