1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef BOOST_ALGORITHM_PARTITION_COPY_HPP
- #define BOOST_ALGORITHM_PARTITION_COPY_HPP
- #include <utility> // for std::pair
- #include <boost/config.hpp>
- #include <boost/range/begin.hpp>
- #include <boost/range/end.hpp>
- namespace boost { namespace algorithm {
- template <typename InputIterator,
- typename OutputIterator1, typename OutputIterator2, typename UnaryPredicate>
- BOOST_CXX14_CONSTEXPR std::pair<OutputIterator1, OutputIterator2>
- partition_copy ( InputIterator first, InputIterator last,
- OutputIterator1 out_true, OutputIterator2 out_false, UnaryPredicate p )
- {
- for ( ; first != last; ++first )
- if ( p (*first))
- *out_true++ = *first;
- else
- *out_false++ = *first;
- return std::pair<OutputIterator1, OutputIterator2> ( out_true, out_false );
- }
- template <typename Range, typename OutputIterator1, typename OutputIterator2,
- typename UnaryPredicate>
- BOOST_CXX14_CONSTEXPR std::pair<OutputIterator1, OutputIterator2>
- partition_copy ( const Range &r, OutputIterator1 out_true, OutputIterator2 out_false,
- UnaryPredicate p )
- {
- return boost::algorithm::partition_copy
- (boost::begin(r), boost::end(r), out_true, out_false, p );
- }
- }}
- #endif
|