From ce5940f86e896b639e8fe60e2901a9d59f739785 Mon Sep 17 00:00:00 2001
From: Jason Abele <jason@ettus.com>
Date: Mon, 26 Jul 2010 15:35:35 -0700
Subject: DBSRX support in UHD

---
 host/include/uhd/utils/algorithm.hpp | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

(limited to 'host/include')

diff --git a/host/include/uhd/utils/algorithm.hpp b/host/include/uhd/utils/algorithm.hpp
index 54bc78494..1b5eacfa9 100644
--- a/host/include/uhd/utils/algorithm.hpp
+++ b/host/include/uhd/utils/algorithm.hpp
@@ -68,6 +68,31 @@ namespace std{
         Range srange(range); std::sort(srange); return srange;
     }
 
+    /*!
+     * A wrapper around std::reverse that takes a range instead of an iterator.
+     *
+     * The elements are reversed into descending order using the less-than operator.
+     *
+     * \param range the range of elements to be reversed
+     */
+    template<typename Range> inline void reverse(Range &range){
+        return std::reverse(boost::begin(range), boost::end(range));
+    }
+
+    /*!
+     * A wrapper around std::reverse that takes a range instead of an iterator.
+     *
+     * The elements are reversed into descending order using the less-than operator.
+     * This wrapper reverses the elements non-destructively into a new range.
+     * Based on the builtin python function reversed(...)
+     *
+     * \param range the range of elements to be reversed
+     * \return a new range with the elements reversed
+     */
+    template<typename Range> inline Range reversed(const Range &range){
+        Range srange(range); std::reverse(srange); return srange;
+    }
+
     /*!
      * Is the value found within the elements in this range?
      *
-- 
cgit v1.2.3