Revision ce5940f8 host/include/uhd/utils/algorithm.hpp

b/host/include/uhd/utils/algorithm.hpp
69 69
    }
70 70

  
71 71
    /*!
72
     * A wrapper around std::reverse that takes a range instead of an iterator.
73
     *
74
     * The elements are reversed into descending order using the less-than operator.
75
     *
76
     * \param range the range of elements to be reversed
77
     */
78
    template<typename Range> inline void reverse(Range &range){
79
        return std::reverse(boost::begin(range), boost::end(range));
80
    }
81

  
82
    /*!
83
     * A wrapper around std::reverse that takes a range instead of an iterator.
84
     *
85
     * The elements are reversed into descending order using the less-than operator.
86
     * This wrapper reverses the elements non-destructively into a new range.
87
     * Based on the builtin python function reversed(...)
88
     *
89
     * \param range the range of elements to be reversed
90
     * \return a new range with the elements reversed
91
     */
92
    template<typename Range> inline Range reversed(const Range &range){
93
        Range srange(range); std::reverse(srange); return srange;
94
    }
95

  
96
    /*!
72 97
     * Is the value found within the elements in this range?
73 98
     *
74 99
     * Uses std::find to search the iterable for an element.

Also available in: Unified diff