6 // Both these functions should ideally be placed into namespace lyx.
7 // Also the using std::less should not be used.
11 /// Returns true if the sequence first,last is sorted, false if not.
13 bool sorted(For first, For last)
15 if (first == last) return true;
17 while (++tmp != last) {
18 if (*tmp < *first++) return false;
23 /// Cmp is the same Cmp as you would pass to std::sort.
24 template <class For, class Cmp>
25 bool sorted(For first, For last, Cmp cmp)
27 if (first == last) return true;
29 while (++tmp != last) {
30 if (cmp(*tmp, *first++)) return false;
35 // } // end of namespace lyx