1 /*==============================================================================
2 Copyright (c) 2010-2011 Bryce Lelbach
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 ==============================================================================*/
8 #ifndef BOOST_DETAIL_SORTED_HPP
9 #define BOOST_DETAIL_SORTED_HPP
11 #include <boost/detail/iterator.hpp>
18 template<class Iterator, class Comp>
19 inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) {
23 Iterator it = first; ++it;
25 for (; it != last; first = it, ++it)
32 template<class Iterator>
33 inline Iterator is_sorted_until (Iterator first, Iterator last) {
34 typedef typename boost::detail::iterator_traits<Iterator>::value_type
37 typedef std::less<value_type> c;
39 return ::boost::detail::is_sorted_until(first, last, c());
42 template<class Iterator, class Comp>
43 inline bool is_sorted (Iterator first, Iterator last, Comp c) {
44 return ::boost::detail::is_sorted_until(first, last, c) == last;
47 template<class Iterator>
48 inline bool is_sorted (Iterator first, Iterator last) {
49 return ::boost::detail::is_sorted_until(first, last) == last;
55 #endif // BOOST_DETAIL_SORTED_HPP