diff options
author | Jason Abele <jason@ettus.com> | 2010-07-26 15:35:35 -0700 |
---|---|---|
committer | Jason Abele <jason@ettus.com> | 2010-08-04 18:50:37 -0700 |
commit | ce5940f86e896b639e8fe60e2901a9d59f739785 (patch) | |
tree | ae257105ff8c7bd3e6542f3322b1ddfe6c540f4c /host/include | |
parent | 3852ee1650701fb3a3fcab984a186055262011b7 (diff) | |
download | uhd-ce5940f86e896b639e8fe60e2901a9d59f739785.tar.gz uhd-ce5940f86e896b639e8fe60e2901a9d59f739785.tar.bz2 uhd-ce5940f86e896b639e8fe60e2901a9d59f739785.zip |
DBSRX support in UHD
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/utils/algorithm.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
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 @@ -69,6 +69,31 @@ namespace std{ } /*! + * 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? * * Uses std::find to search the iterable for an element. |