[Scummvm-git-logs] scummvm master -> a95427f964991a88175376fe8e04de6463444c05

sev- noreply at scummvm.org
Tue Aug 6 19:55:22 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a95427f964 COMMON: Add Common::reverse() implementation with iterators


Commit: a95427f964991a88175376fe8e04de6463444c05
    https://github.com/scummvm/scummvm/commit/a95427f964991a88175376fe8e04de6463444c05
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-06T21:55:09+02:00

Commit Message:
COMMON: Add Common::reverse() implementation with iterators

Changed paths:
    common/algorithm.h


diff --git a/common/algorithm.h b/common/algorithm.h
index ab0e320329a..fbddb27d668 100644
--- a/common/algorithm.h
+++ b/common/algorithm.h
@@ -256,6 +256,12 @@ Op for_each(In first, In last, Op f) {
 	return f;
 }
 
+template<typename T>
+void reverse(T first, T last) {
+  for (; first != last && first != --last; ++first)
+    SWAP(*first, *last);
+}
+
 /**
  * @}
  */




More information about the Scummvm-git-logs mailing list