1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2016-2016. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/container for documentation.
9 //////////////////////////////////////////////////////////////////////////////
10 #ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP
11 #define BOOST_CONTAINER_DETAIL_IS_SORTED_HPP
13 #ifndef BOOST_CONFIG_HPP
14 # include <boost/config.hpp>
17 #if defined(BOOST_HAS_PRAGMA_ONCE)
25 template <class ForwardIterator, class Pred>
26 bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred)
29 ForwardIterator next = first;
30 while (++next != last){
31 if(pred(*next, *first))
39 template <class ForwardIterator, class Pred>
40 bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pred)
43 ForwardIterator next = first;
44 while (++next != last){
45 if(!pred(*first, *next))
54 } //namespace container {
57 #endif //#ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP