123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #ifndef BOOST_ALGORITHM_ALL_OF_HPP
- #define BOOST_ALGORITHM_ALL_OF_HPP
- #include <boost/config.hpp>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- namespace boost { namespace algorithm {
- template<typename InputIterator, typename Predicate>
- BOOST_CXX14_CONSTEXPR bool all_of ( InputIterator first, InputIterator last, Predicate p )
- {
- for ( ; first != last; ++first )
- if ( !p(*first))
- return false;
- return true;
- }
- template<typename Range, typename Predicate>
- BOOST_CXX14_CONSTEXPR bool all_of ( const Range &r, Predicate p )
- {
- return boost::algorithm::all_of ( boost::begin (r), boost::end (r), p );
- }
- template<typename InputIterator, typename T>
- BOOST_CXX14_CONSTEXPR bool all_of_equal ( InputIterator first, InputIterator last, const T &val )
- {
- for ( ; first != last; ++first )
- if ( val != *first )
- return false;
- return true;
- }
- template<typename Range, typename T>
- BOOST_CXX14_CONSTEXPR bool all_of_equal ( const Range &r, const T &val )
- {
- return boost::algorithm::all_of_equal ( boost::begin (r), boost::end (r), val );
- }
- }}
- #endif
|