1 // Copyright Neil Groves 2009. Use, modification and
2 // distribution is subject to the Boost Software License, Version
3 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
7 // For more information, see http://www.boost.org/libs/range/
9 #ifndef BOOST_RANGE_ALGORITHM_INPLACE_MERGE_HPP_INCLUDED
10 #define BOOST_RANGE_ALGORITHM_INPLACE_MERGE_HPP_INCLUDED
12 #include <boost/concept_check.hpp>
13 #include <boost/range/begin.hpp>
14 #include <boost/range/end.hpp>
15 #include <boost/range/concepts.hpp>
23 /// \brief template function inplace_merge
25 /// range-based version of the inplace_merge std algorithm
27 /// \pre BidirectionalRange is a model of the BidirectionalRangeConcept
28 /// \pre BinaryPredicate is a model of the BinaryPredicateConcept
29 template<class BidirectionalRange>
30 inline BidirectionalRange& inplace_merge(BidirectionalRange& rng,
31 BOOST_DEDUCED_TYPENAME range_iterator<BidirectionalRange>::type middle)
33 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
34 std::inplace_merge(boost::begin(rng), middle, boost::end(rng));
39 template<class BidirectionalRange>
40 inline const BidirectionalRange& inplace_merge(const BidirectionalRange& rng,
41 BOOST_DEDUCED_TYPENAME boost::range_iterator<const BidirectionalRange>::type middle)
43 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
44 std::inplace_merge(boost::begin(rng), middle, boost::end(rng));
49 template<class BidirectionalRange, class BinaryPredicate>
50 inline BidirectionalRange& inplace_merge(BidirectionalRange& rng,
51 BOOST_DEDUCED_TYPENAME boost::range_iterator<BidirectionalRange>::type middle,
54 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<BidirectionalRange> ));
55 std::inplace_merge(boost::begin(rng), middle, boost::end(rng), pred);
60 template<class BidirectionalRange, class BinaryPredicate>
61 inline const BidirectionalRange& inplace_merge(const BidirectionalRange& rng,
62 BOOST_DEDUCED_TYPENAME boost::range_iterator<const BidirectionalRange>::type middle,
65 BOOST_RANGE_CONCEPT_ASSERT(( BidirectionalRangeConcept<const BidirectionalRange> ));
66 std::inplace_merge(boost::begin(rng), middle, boost::end(rng), pred);
71 using range::inplace_merge;
74 #endif // include guard