1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef BOOST_ALGORITHM_IS_PARTITIONED_HPP
- #define BOOST_ALGORITHM_IS_PARTITIONED_HPP
- #include <boost/config.hpp>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- namespace boost { namespace algorithm {
- template <typename InputIterator, typename UnaryPredicate>
- BOOST_CXX14_CONSTEXPR bool is_partitioned ( InputIterator first, InputIterator last, UnaryPredicate p )
- {
- for ( ; first != last; ++first )
- if ( !p (*first))
- break;
- for ( ; first != last; ++first )
- if ( p (*first))
- return false;
- return true;
- }
- template <typename Range, typename UnaryPredicate>
- BOOST_CXX14_CONSTEXPR bool is_partitioned ( const Range &r, UnaryPredicate p )
- {
- return boost::algorithm::is_partitioned (boost::begin(r), boost::end(r), p);
- }
- }}
- #endif
|