Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:11

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2016-2016. Distributed under the Boost
0004 // Software License, Version 1.0. (See accompanying file
0005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // See http://www.boost.org/libs/container for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 #ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP
0011 #define BOOST_CONTAINER_DETAIL_IS_SORTED_HPP
0012 
0013 #ifndef BOOST_CONFIG_HPP
0014 #  include <boost/config.hpp>
0015 #endif
0016 
0017 #if defined(BOOST_HAS_PRAGMA_ONCE)
0018 #  pragma once
0019 #endif
0020 
0021 namespace boost {
0022 namespace container {
0023 namespace dtl {
0024 
0025 template <class ForwardIterator, class Pred>
0026 bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred)
0027 {
0028    if(first != last){
0029       ForwardIterator next = first;
0030       while (++next != last){
0031          if(pred(*next, *first))
0032             return false;
0033          ++first;
0034       }
0035    }
0036    return true;
0037 }
0038 
0039 template <class ForwardIterator, class Pred>
0040 bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pred)
0041 {
0042    if(first != last){
0043       ForwardIterator next = first;
0044       while (++next != last){
0045          if(!pred(*first, *next))
0046             return false;
0047          ++first;
0048       }
0049    }
0050    return true;
0051 }
0052 
0053 }  //namespace dtl {
0054 }  //namespace container {
0055 }  //namespace boost {
0056 
0057 #endif   //#ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP