diff --git a/mex/sources/bytecode/bytecode.cc b/mex/sources/bytecode/bytecode.cc
index b19188dc91b0a7c12b13421c6d14a3219899c69d..e3c244ab96d870348de344a22542119fe630bd5c 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 2a2e0661589e224ce1ddc633a8dac126c62a2fef..1ae4a575d8423522b7bdee06297581c474b8f328 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}