Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:15

0001 //  Copyright Bryce Lelbach 2010
0002 //  Copyright Neil Groves 2009. Use, modification and
0003 //  distribution is subject to the Boost Software License, Version
0004 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
0005 //  http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 //
0008 // For more information, see http://www.boost.org/libs/range/
0009 //
0010 #ifndef BOOST_RANGE_ALGORITHM_EXT_IS_SORTED_HPP_INCLUDED
0011 #define BOOST_RANGE_ALGORITHM_EXT_IS_SORTED_HPP_INCLUDED
0012 
0013 #include <boost/concept_check.hpp>
0014 #include <boost/range/begin.hpp>
0015 #include <boost/range/end.hpp>
0016 #include <boost/range/concepts.hpp>
0017 #include <boost/range/value_type.hpp>
0018 #include <boost/detail/is_sorted.hpp>
0019 #include <algorithm>
0020 
0021 namespace boost
0022 {
0023     namespace range
0024     {
0025 
0026 /// \brief template function is_sorted
0027 ///
0028 /// range-based version of the is_sorted std algorithm
0029 ///
0030 /// \pre SinglePassRange is a model of the SinglePassRangeConcept
0031 template<class SinglePassRange>
0032 inline bool is_sorted(const SinglePassRange& rng)
0033 {
0034     BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
0035     BOOST_RANGE_CONCEPT_ASSERT((LessThanComparableConcept<BOOST_DEDUCED_TYPENAME
0036       range_value<const SinglePassRange>::type>));
0037     return ::boost::detail::is_sorted(boost::begin(rng), boost::end(rng));
0038 }
0039 
0040 /// \overload
0041 template<class SinglePassRange, class BinaryPredicate>
0042 inline bool is_sorted(const SinglePassRange& rng, BinaryPredicate pred)
0043 {
0044     BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<const SinglePassRange>));
0045     BOOST_RANGE_CONCEPT_ASSERT((BinaryPredicateConcept<BinaryPredicate,
0046       BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type,
0047       BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type>));
0048     return ::boost::detail::is_sorted(boost::begin(rng), boost::end(rng), pred);
0049 }
0050 
0051     } // namespace range
0052 
0053 using range::is_sorted;
0054 
0055 } // namespace boost
0056 
0057 #endif // include guard